Option Explicit
Private WithEvents wb As WebBrowser
Private uf As New UserForm1
Sub GetSomeData()
Set wb = uf.WebBrowser1
wb.RegisterAsBrowser = True
wb.Navigate "http://www.DOMAIN.com/data.asp"
End Sub
Private Sub wb_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim TempFileName As String
TempFileName = ThisWorkbook.Path & Application.PathSeparator & Timer & ".html"
Open TempFileName For Output As #1
Print #1, wb.Document.All(0).outerHTML
Close #1
With ActiveSheet.QueryTables.Add("URL;file:///" & TempFileName, Range("A1"))
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "15,19"
.Refresh BackgroundQuery:=False
.Delete
End With
On Error Resume Next
Kill TempFileName
Set wb = Nothing
Unload uf
Set uf = Nothing
End Sub