none
OLE RRS feed

  • Question

  • Hi,

    I have an application in PowerBuilder. I use OLE to link with MS word and print documents. It works fine with Word 2000, but since I upgraded to Word 2007, it gives me an error at:

    OLEobject.documents.add (template name)

    The error: "Error Calling external Object ole.documents.add

    Any ideas

    Nand

    Wednesday, January 22, 2014 5:14 PM

Answers

  • Hi,

    According to your description, you are developing an application with PowerBuilder and add a MS Word document in this application.

    I think your issue may not be related to Word development and I find the OLEobject.documents.add method may not be a method of OLEObject Object in Microsoft libraries. I assume it may be a 3rd-party method.

    So for the questions about property or method of PowerBuilder library, I suggest you resorting to PowerBuilder official support for more effective responses.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 23, 2014 6:34 AM
    Moderator

All replies

  • Hello Nand,

    First of all, I'd recommend breaking the chain of calls into separate lines of code, for example:

    OLEobject.documents.add (template name)
    
    documents = OLEObject.documents
    document = documents.add(template name)

    And now you need to debug the code and find the problematic line of code.

    Note, the Add method of the Documents class from the Word Object Model accepts four parameters. Did you try to specify all of them? If so, what parameters do you pass?

    • Proposed as answer by Eugene Astafiev Wednesday, January 29, 2014 1:24 PM
    Wednesday, January 22, 2014 6:58 PM
  • Hi,

    According to your description, you are developing an application with PowerBuilder and add a MS Word document in this application.

    I think your issue may not be related to Word development and I find the OLEobject.documents.add method may not be a method of OLEObject Object in Microsoft libraries. I assume it may be a 3rd-party method.

    So for the questions about property or method of PowerBuilder library, I suggest you resorting to PowerBuilder official support for more effective responses.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, January 23, 2014 6:34 AM
    Moderator
  • Hi Nand

    I think Eugene may be more on the right track than Luna. Documents.Add was and is certainly a method of the Word object library...

    Another question that occurs to me is: What kind of file is the template you refer to with templatename? Is it a *.dot? Does it contain macros? If you try to create a new document from this file as an end-user, using the "Office Button"/New command in the Word application, can you create a document or does that also give you an error? If an error, what's the error information?


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, January 23, 2014 2:20 PM
    Moderator
  • Hi Cindy,

    Since Nand said, he is using "OLEobject.documents.add (template name)". After researching, I cannot find the documents property of OLEobject object, though there is Documents.add method in Word Object Model. There is only Add method of OLEobject object.

    Thanks.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, January 24, 2014 1:55 AM
    Moderator
  • Nand,

    Could you please clarify where does OLEobject come from? Does it represent an instance of the Word Application class or belongs to PowerBuilder?

    @Luna, most probably the OLEobject represents an instance of the Application class from the Word object model.

    Friday, January 24, 2014 12:41 PM