The following should do you. You'll need project references to Microsoft Scripting Runtime (C:\WINDOWS\system32\scrrun.dll), Microsoft HTML Object Library (C:\WINDOWS\system32\MSHTML.TLB) & Mcirosoft Internet Controls (C:\WINDOWS\system32\shdocvw.dll).
Code:
Sub ExplorerCont********************()
Dim IExp As SHDocVw.InternetExplorer
Dim hDoc As MSHTML.HTMLDocument
Dim fsoFSO As Scripting.FileSystemObject
Dim fsoFile As Scripting.TextStream
Set IExp = New SHDocVw.InternetExplorer
' You don't have to show the app window
'IExp.Visible = True
IExp.Navigate "http://www.google.com"
' Wait for the page to load
Do Until IExp.Busy = False
DoEvents
Loop
' Set the HTML Document
Set hDoc = IExp.Document
' Set up the FileSystemObject and create a text file
Set fsoFSO = New Scripting.FileSystemObject
Set fsoFile = fsoFSO.CreateTextFile(Filename:="C:\Webpage source code.txt")
' Write the source code of the webpage to the text file
fsoFile.WriteLine Text:=hDoc.Body.innerHTML
fsoFile.Close
' Quit Internet Explorer
IExp.Quit
' De-reference variables
Set IExp = Nothing
Set hDoc = Nothing
Set fsoFSO = Nothing
Set fsoFile = Nothing
End Sub