Error 4605 calling Word.Document.Save with Word 2002 SP1
I have a test VB6 exe project with a WebBrowser control, called web1 (added via Project, Components, Microsoft Internal Controls). My project also references the Microsoft Word 10.0 Object Library.
As well as the WebBrowser control, my form has a Save button (cmdSave). Here is the complete code:
Code:
Private g_objDocument As Word.Document
Private Sub cmdSave_Click()
g_objDocument.Save
End Sub
Private Sub Form_Load()
Dim strFileName As String
strFileName = App.Path & "\WordWrapper.doc"
web1.Navigate strFileName
End Sub
Private Sub web1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Set g_objDocument = pDisp.Document
End Sub
The idea is when I run the exe, it loads a Word document into the WebBrowser control. This document is also assigned to
a global Word.Document object, g_objDocument, when web1 navigates to it. The problem occurs when I try to save the document (in cmdSave_Click). I get the error:
"The Save method or property is not available because this document is in another application."
This error occurs with Word 2002 SP 1 (on Windows XP), but not with Word 2000 SP3.
Please help.
Re: Error 4605 calling Word.Document.Save with Word 2002 SP1
Did U found any solution to this?
Best regards,
Krzemo.
Re: Error 4605 calling Word.Document.Save with Word 2002 SP1
See this:
Code:
' mobjCurrentDocument.Save with Word 2002 gives the error 4605:
' "The Save method or property is not available because this document is in
' another application".
' This was raised with Microsoft who acknowledged it is a
' bug in Word 2002 and suggested the following workaround.
web1.ExecWB OLECMDID_SAVE, OLECMDEXECOPT_DONTPROMPTUSER
Re: Error 4605 calling Word.Document.Save with Word 2002 SP1
Works very good.:thumb:
Thanks a lot!
Best regards,
Krzemo.