OK, i wrote for you the biggest part of code...
The function below was tested on the web pages with 'html' extension.
Option Explicit
Private Function SaveWebPage(ByVal sUrl As String, ByVal sFilePath As String) As Boolean
Dim iMessage As CDO.Message
Dim adodbstream As ADODB.Stream
Dim bBool As Boolean
On Error GoTo Err_SaveWebPage
bBool = True
Set iMessage = New CDO.Message
Set adodbstream = New ADODB.Stream
iMessage.CreateMHTMLBody sUrl, CDO.CdoMHTMLFlags.cdoSuppressNone, "", ""
adodbstream.Type = ADODB.StreamTypeEnum.adTypeText
adodbstream.Charset = "US-ASCII"
adodbstream.Open
iMessage.DataSource.SaveToObject adodbstream, "_Stream"
adodbstream.SaveToFile sFilePath, ADODB.SaveOptionsEnum.adSaveCreateOverWrite
Exit_SaveWebPage:
On Error Resume Next
Set iMessage = Nothing
Set adodbstream = Nothing
SaveWebPage = bBool
Exit Function
Err_SaveWebPage:
bBool = False
MsgBox Err.Description, vbExclamation, Err.Number
Resume Exit_SaveWebPage
End Function
Usage:
Not full functional, without error handlers, but shows some technics!
Private Sub CommandButton1_Click()
Dim bRetVal As Boolean
Dim sUrl As String, sDstFile As String, sTmp As String
Dim sLookFor As Variant, i As Integer, j As Integer
sLookFor = Array("<table>", "</table>", "<tr>", "</tr>", "<th>", "</th>", "<td>", "</td>")
sUrl = Me.TxtUrl.Text
sDstFile = Me.TxtDstFile.Text
bRetVal = SaveWebPage(sUrl, sDstFile)
If Not bRetVal Then Exit Sub
Open sDstFile For Input Lock Read As #1
Do While Not EOF(1)
Line Input #1, sTmp
For i = LBound(sLookFor) To UBound(sLookFor)
j = InStr(1, sTmp, sLookFor(i))
If j > 0 Then
MsgBox "'" & sLookFor(i) & "' found in the string: " & vbCrLf & _
"'" & sTmp & "'" & vbCrLf & _
"on the position: " & j, vbInformation, "Message"
End If
Next i
Loop
Close #1
End Sub
You should look too at this site:
http://connectionstrings.com/html-table[
^]