ole control - open document from template

G

gnn

I am a beginner with ole automation.
From Powerbuilder, I am trying to add a new word document from a template
into an ole object

My code is pretty simple -

string l_s_template /* Holds location of the template .dot file */
l_ole_doc = l_ole_word.Application.Documents.Add(l_s_template)

Most macros from the template function okay except that on a couple of tabs
from the templates toolbar, i get vba error messages-
1. Runtime error 5941 - the requested member of the collection does not exist
2. Run-time error '-2147467259(80004005)': Automation error, unspecified error
3. Run-timeerror '5' : Invalid procedure call or argument

The above errors do not happen when i create a document by doubleclicking on
the .dot file from windows explorer. Any suggestions on how i can overcome
this problem?

Thanks
 
C

Cindy M.

Hi gnn,
I am a beginner with ole automation.
From Powerbuilder, I am trying to add a new word document from a template
into an ole object

My code is pretty simple -

string l_s_template /* Holds location of the template .dot file */
l_ole_doc = l_ole_word.Application.Documents.Add(l_s_template)

Most macros from the template function okay except that on a couple of tabs
from the templates toolbar, i get vba error messages-
1. Runtime error 5941 - the requested member of the collection does not exist
2. Run-time error '-2147467259(80004005)': Automation error, unspecified error
3. Run-timeerror '5' : Invalid procedure call or argument

The above errors do not happen when i create a document by doubleclicking on
the .dot file from windows explorer. Any suggestions on how i can overcome
this problem?
No idea, since we have no idea what's behind the "tabs from the templates
toolbar". This isn't something built into Word, and you don't give us any
details about the code triggering the errors, so it's impossible to say.

You also don't mention which version of Word is involved.

Perhaps you need to ask in a PowerBuilder group how OLE automation from within
PowerBuilder can interfere with Word's internal macros...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top