Save method fails in Word XP automation 
Author Message
 Save method fails in Word XP automation

I have a problem while trying to use Save a document in Word XP through
automation. The Save method fails only when a document is opened through an
IE browser. The error message which I get is  " The Save Method or Property
is not available because it is in another application". The same program
works with Word 2000 & Word 97 without any problem. I am listing bellow the
code for the program

      COleVariant vTrue((short)TRUE),
                vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR);


      // Translate server ProgID into a CLSID. ClsidFromProgID
      // gets this information from the registry.
      CLSID clsid;
      CLSIDFromProgID(L"Word.Application", &clsid);

      // Get an interface to the running instance, if any..
      IUnknown *pUnk;
      HRESULT hr = GetActiveObject(clsid, NULL, (IUnknown**)&pUnk);

      // Get IDispatch interface for Automation...
      IDispatch *pDisp;
      hr = pUnk->QueryInterface(IID_IDispatch, (void **)&pDisp);

      // Release the no-longer-needed IUnknown...

    _Application    oApp( pDisp);

    //Get the active document's IDispatch
    _Document oDoc = oApp.GetActiveDocument();

    //Call the Save method through IDispatch
    oDoc.Save();                   <--------------------------METHOD FAILS

/*   oDoc.SaveAs(COleVariant("c:\\doc1.doc"),    <----------SAVEAS METHOD
                    vFalse, COleVariant(""), vTrue, COleVariant(""),
                    vFalse, vFalse, vFalse, vFalse, vFalse);

Can anyone tell me why the method fails and what method should i use to save


Wed, 16 Feb 2005 15:10:43 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Save Method fails in WordXP Automation

2. RTF saved by Word 97 failed in Help Compilation

3. I always failed on return from save method

4. Converter for pocket word into word from Office XP

5. WORD Automation via C#:BuiltInProperties in Word

6. Automation problem with Word: Couldn't get Word object

7. WORD OLE Automation - Writing on top of a word document

8. Basic Open File, Save/ Save as functions for dos word processor

9. Dynamic Method call ( Invoke method ) failing in service when compiled as ReleaseMinDependancy

10. Excel XP automation in C#

11. Word XP in C#

12. one-to-many relationship in word automation


Powered by phpBB® Forum Software