
Saving as a file a web page accessed via a form (doesn't work)
Using the InternetExplorer.Application object I'm able to navigate to
a web page, fill out a form, submit it, and then see the page that
results from the form input. But when I go to save this second web
page as a file, it will only save the first page -- the one with the
form on it that I navigated to at the start.
I've tried using "While oIE.ReadyState <> 4" to make sure that the
second page is completely loaded before I try to save the page, but it
doesn't help. I've also tried this on three different sites, and get
the same results.
Any suggestions? Thanks in advance.
Mark Davies
---- Part of the code copied below ---------
Dim oIE, oRange, oWSHShell, oFS, oFile
Set oIE = CreateObject("InternetExplorer.Application")
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oFile = oFS.CreateTextFile("c:\doit.htm")
oIE.Visible = True
oIE.Navigate " http://www.*-*-*.com/ "
While oIE.ReadyState <> 4
Wend
oIE.document.thatform.Item("lastname").Value = "smith"
. . . .
oIE.document.thatform.Item("Submit").Click
While oIE.ReadyState <> 4 ' This should help, right?
Wend
Set oRange = oIE.document.body.createTextRange()
oFile.Write oRange.HtmlText
oFile.Close
---- End of code ---------