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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to correctly deploy an application that 'talks' with Word

Status
Not open for further replies.

mrocco

Programmer
Oct 24, 2002
1
IT
Hello Everybody,
I'm trying to automate the process of printing a Word document from command line... obiouvsly everything works fine on MY machine... but as soon as I move to another machine, the application hangs and gives me an error.
Here's the code:
[...]
Dim msWord As Word.Application
Set msWord = GetObject(Class:="Word.Application.8")
strSourceFileNameComplete = "C:\test.doc"
msWord.Visible = False
msWord.ActivePrinter = "Acrobat Distiller"
'so far everything works fine...
'but next line doesn't get executed
msWord.Documents.Open strSourceFileNameComplete
[...]
I can actually see Word starting... but as soon as I try to open a specific file, it hangs.
Again, on my machine works fine... but on any other machine it hangs. I also tried to install Visual Studio on the target machine, recompile it (adding the reference to Word10 obj lib), uninstall Visual Studio and run the application: it works.
What am I missing??
Thanks a lot for your responses!
Cheers,
--marco
 
Big question. Does everyone have Word 97 on their computers. You have used it as a reference so they will need to have the libraries on their computer.

You could also do some verification on your function. For instance, you are using "C:\Text.doc" and if you run in in this state they would all have to have it in their root. Use Dir or File System Object to verify the file exists before trying to open it.

Another item, and probably significant, is that you are using a reference to the Word 10 library but you are trying to instantiate it as Word.Application.8, which is Word 97.

-------------------------------------
scking@arinc.com
Try to resolve problems independently
Then seek help among peers or experts
But TEST recommended solutions
-------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top