CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83

    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.

  2. #2
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: Error 4605 calling Word.Document.Save with Word 2002 SP1

    Did U found any solution to this?


    Best regards,
    Krzemo.

  3. #3
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83

    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

  4. #4
    Join Date
    Nov 2004
    Location
    Poland
    Posts
    1,355

    Re: Error 4605 calling Word.Document.Save with Word 2002 SP1

    Works very good.

    Thanks a lot!

    Best regards,
    Krzemo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured