mercoledì 10 luglio 2013

query tabella html

Attribute VB_Name = "query_tabella_html"

'

Option Explicit

'

' vba - Excel

' crea query su tutte le tabelle di una pagina htlm di un sito.

' la query rimane collegata alla pagina. La query può essere aggiornata quando si vuole.

' uso: call QueryTabellaHtml("http://www.<sito>.<suffisso>/pag-115.html")

'

Sub QueryTabellaHtml(paginahtml)

'

'

Sheets.Add

Range("A1").Select

Application.left = 115.75

Application.top = 62.5

'With ActiveSheet.QueryTables.Add(Connection:="URL;C:\TEMP\GRIGLIA1.HTML", Destination:=Range("A1"))

With ActiveSheet.QueryTables.Add(Connection:="URL;" & paginahtml, Destination:=Range("A1"))

.Name = "GRIGLIA1"

.FieldNames = True

.RowNumbers = False

.FillAdjacentFormulas = False

.PreserveFormatting = True

.RefreshOnFileOpen = False

.BackgroundQuery = True

.RefreshStyle = xlInsertDeleteCells

.SavePassword = False

.SaveData = True

.AdjustColumnWidth = True

.RefreshPeriod = 0

.WebSelectionType = xlAllTables ' tutte le tabelle

.WebFormatting = xlWebFormattingNone

.WebPreFormattedTextToColumns = True

.WebConsecutiveDelimitersAsOne = True

.WebSingleBlockTextImport = False

.WebDisableDateRecognition = False

.Refresh BackgroundQuery:=False

End With

'

End Sub

'

Nessun commento:

Posta un commento