Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with CreateObject 1

Status
Not open for further replies.

pipk

Programmer
Feb 20, 2001
455
GB
I am having a problem running script that basically uses CreateObject("Word.Application") to stream an RTF file from my temp directory, change the current default printer for that word application to one sent in as a parm. So it is treamed directly to printer device sitting on our network.

The VB will execute without a problem when I run it (with hardcoded parms) in an activex test container, or from my IDE (Allfusion:plex). But when the same script is run from my company's main application (bulk of which is written using an old version (IBM oS2 I think) of C, it falls over on the CreateObject statement with a genric VB script error (i.e. blank dialog with no error messages or return codes).

Does anyone have an idea why a perfectly reasonable piece of VB scripot should refuse to work when run from a different environment?

Any help much appreciated.
 
Is it being run on a different machine?

using word.application relies on the users having word installed on their machine



 
No, this is the same script running on the same machine, just being called via different processes - one works and one doesn't.

I was wondering if there was some sort of limitation of VBScript and if there are limitations imposed on the objects that can be created by some applications.
 
Hi Ouch

We finally got this one resolved. The error turnoed out to be a -2147417843 (an automation error). It turns out that out core system written in C++ wasn't allowing the CreateObjecvt to work in the same thread.

The original developer (who had disappeared for a months holiday in Australia - hence my dilemnma) came back and solved the issue in 5 seconds flat by spawning a new thread to run the VB.

Thought someone might find this useful.

Thanks for your help anyway.

PIPK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top