dwe0608
asked on
VB6 and MsWord in a Webbrowser Control
Hi Guys
In the following function:
when I unload the browser control, it fails on this line:
MsgBox "File opened by: " & oDocument.Application.Name
with an error 438 saying object doesnt support this property or method.
To avoid the use of "on error resume next", how would I fail gracefully.
I have tried navigating away from the word document by implementing a function
which is called in the form unload event
MTIA
DWE
In the following function:
Private Sub wb_NavigateComplete2(ByVal pDisp As Object, url As Variant)
'On Error Resume Next
Set oDocument = pDisp.Document
MsgBox "File opened by: " & oDocument.Application.Name
If (pDisp Is wb.Object) Then
'Debug.Print "wb_NavigateComplete2 = " & Now() & " - " & url
'MsgBox "Complete - " & url
bDoneDownloading = True
End If
' hide tools bars
wb.ExecWB OLECMDID_HIDETOOLBARS, OLECMDEXECOPT_DONTPROMPTUSER
End Sub
when I unload the browser control, it fails on this line:
MsgBox "File opened by: " & oDocument.Application.Name
with an error 438 saying object doesnt support this property or method.
To avoid the use of "on error resume next", how would I fail gracefully.
I have tried navigating away from the word document by implementing a function
Public Sub UnloadWord()
wb.Navigate2 "about:blank" ' So that webbrowser starts in 'msWord mode' and empty document
End Sub
which is called in the form unload event
MTIA
DWE
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
no expert assistance in arriving at the answer
other technique would be to check if oDocument is nothing, and if not, then check oDocument.Application (if it's nothing or not), and finally use oDocument.Application.Name