Hello fello WebBrowser coder's please can you
"help".
On the file menu of IE 5.x you can use the SaveAs
command to save a web page and all referenced files.
IE 5.x then opens the Save webpage dialog box so
you can choose a directory
I am trying to use the ExecWB OLECMDID_SAVEAS
method to save a web page an all referenced files from VBA.
but I receive Run-time error
'-2147221248(80040100)': Method 'ExecWB of object 'IWebBrowser2'
failed.
I've hooked up the event sink in the following
manner.
In the general declarations section of a class
module I used a public With Events Event Sink as follows.
Public WithEvents m_oWbSink As
SHDocVw.InternetExplorer
'Global reference to an instance of the
browser
Dim g_oIE As New SHDocVw.InternetExplorer
'Global reference to an
instance of a class that can sink the browser's events
Dim g_oIESink As New
Class1
Private Sub CommandButton1_Click()
'On Error
Resume Next
g_oIE.navigate "My
Url.com"
g_oIE.Application.Visible =True
g_oIE.Application.ExecWB OLECMDID_SAVEAS,
OLECMDEXECOPT_PROMPTUSER
End Sub
Private Sub UserForm_Initialize()
Set
g_oIESink.m_oWbSink = g_oIE
End Sub
The code works ok up to the,
g_oIE.Application.ExecWB
OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER
command but then generates
the error on the line above.
If I click the run button again in the Visual Basic
editor Internet explorer then displays the save Web page dialog box
and then allows me to save the page.
If I ckick the button that runs the code again I
get no more errors until I restart the app.
Could this error be generated by the QueryStatusWB
Method or somthing else.
Please help and many thanks in
advance.
Simon Franklin