PDA

View Full Version : How to save webpage as html to drive



erectronics
05-21-2012, 07:12 PM
Hey,
My VBA code interacts with a website. The code enters user data from a spreadsheet (Excel 2010) into the site, which in turn displays search result based on the user data. I wish to save the entire web page as a html file in a specified folder on a local drive. The name of the file will be based on the user data. For instance, the user data is "alice_1234", then the html file name will be alice_1234.html.
Thanks,
Alice

BrianMH
05-22-2012, 05:19 AM
If you just need the raw html this works for me.

IFF = FreeFile
strFileName = "myfilename"
Open "C:\" & strFileName & ".html" For Output As IFF
Print #IFF, objIE.Document.DocumentElement.innerhtml
Close #IFF