Moderatori: Anthony47, Flash30005
Sub prova()
'
'
'
'
Sheets("pp").Select
Range("M1").Select
Selection.Copy
Application.CutCopyMode = False
ActiveWorkbook.Queries.Add Name:="Table 0 (3)", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Origine = Web.Page(Web.Contents(""https://www.betexplorer.com/soccer/argentina/primera-nacional/""))," & Chr(13) & "" & Chr(10) & " Data0 = Origine{0}[Data]," & Chr(13) & "" & Chr(10) & " #""Modificato tipo"" = Table.TransformColumnTypes(Data0,{{"""", type text}, {""2"", type text}, {""3"", type text}, {""4"", type any}, {""B's"", Int64.Type}, {""1"", Int64.Type}, {""X"", Int64.Type}, {""22"", Int64.Type}," & _
" {""5"", type text}, {""6"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Modificato tipo"""
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=""Table 0 (3)"";Extended Properties=""""" _
, Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM [Table 0 (3)]")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_0__3"
.Refresh BackgroundQuery:=False
End With
Application.CommandBars("Queries and Connections").Visible = False
End Sub
Non sono convinto di aver capito bene quale sia quindi la richiesta; supponiamo che sia "come faccio a creare una query con un nome che sia gia' presente".ho provato con il registratore macro ad importare la tabella che mi interessa su windows 11 ma non mi permette di caricarla nuovamente perchè la querry è già presente con lo stesso nome.
visto che ho bisogno di importare nello stesso range tabelle con link diversi
grazie
'... (altre istruzioni)
Application.CutCopyMode = False
'AGGIUNGERE...
On Error Resume Next
ActiveSheet.ListObjects(1).Delete
ActiveWorkbook.Queries("Table 0 (3)").Delete
On Error GoTo 0
'...AGGIUNTO
ActiveWorkbook.Queries.Add Name:="Table 0 (3)", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Origine = Web.Page(Web.Contents(""https://www.betexplorer.com/soccer/argentina/primera-nacional/""))," & Chr(13) & "" & Chr(10) & " Data0 = Origine{0}[Data]," & Chr(13) & "" & Chr(10) & " #""Modificato tipo"" = Table.TransformColumnTypes(Data0,{{"""", type text}, {""2"", type text}, {""3"", type text}, {""4"", type any}, {""B's"", Int64.Type}, {""1"", Int64.Type}, {""X"", Int64.Type}, {""22"", Int64.Type}," & _
" {""5"", type text}, {""6"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Modificato tipo"""
'... (altre istruzioni)
Sub sssssssssssssss()
'
' sssssssssssssss Macro
Sheets("pp").Select
Range("M1").Select
Selection.Copy
Application.CutCopyMode = False
'AGGIUNGERE...
On Error Resume Next
ActiveSheet.ListObjects(1).Delete
On Error GoTo 0
For Each mq In ActiveWorkbook.Queries
mq.Delete
Next mq
For Each wq In ActiveSheet.QueryTables
wq.Delete
Next wq
'...AGGIUNTO
ActiveWorkbook.Queries.Add Name:="Table 0 (3)", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Origine = Web.Page(Web.Contents(""" & Range("M1").Value & """))," & Chr(13) & "" & Chr(10) & " Data0 = Origine{0}[Data]," & Chr(13) & "" & Chr(10) & " #""Modificato tipo"" = Table.TransformColumnTypes(Data0,{{"""", type text}, {""2"", type text}, {""3"", type text}, {""4"", type any}, {""B's"", Int64.Type}, {""1"", Int64.Type}, {""X"", Int64.Type}, {""22"", Int64.Type}," & _
" {""5"", type text}, {""6"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Modificato tipo"""
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=""Table 0 (3)"";Extended Properties=""""" _
, Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM [Table 0 (3)]")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells 'xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table_0__3"
.Refresh BackgroundQuery:=False
End With
Application.CommandBars("Queries and Connections").Visible = False
End Sub
Torna a Applicazioni Office Windows
Macro modifica date scelta periodo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 11 |
Supporto per sviluppo macro VBA Ordinare per data Autore: Carletto Ribolla |
Forum: Applicazioni Office Windows Risposte: 3 |
problema ricezione notifiche outlook Autore: gianscooby |
Forum: Sistemi Operativi Windows Risposte: 2 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
Visitano il forum: Nessuno e 75 ospiti