I have working with word document in lotus R7. During that I have create word doc object, assigned it to word document & then print that document. But in print action I found Automation Object Error. My Code is :-
Sub Initialize
On Error Goto errorHandler
Dim path As String
path = "C:\Sample1.doc"
Set wdo = CreateObject("Word.Application")
wdo.visible=True
Set wdocs = wdo.Documents
Msgbox "PQRE"
wdo.ActivePrinter = "\\sphinx\HP"
Set wdoc = wdocs.Open(path )
wdoc.PrintOut ' Automation Error Occured
Exit Sub
errorHandler:
Msgbox "error is At:- "& Cstr(Erl()) & " error is :-" & Error() & " in agSam123"
Call KillWordObject()
Exit Sub
End Sub
Error is at line “Set wdoc = wdocs.Open(path )” Does Some One has any idea about how to solve Automation error.
I have also close all word application before running this code.
I have also run same code on R6.5 It Run Well On R6.5. But On 7 It shows Automation Error. Does There is any different in Print Command of R6.5 & R7. If so then which is it. Does any one has some idea about it.
Subject: About Automation Object Error During Word Document Print
-
Check if the default printer is missing on the pc you’re getting the Automation Error.
-
Kill all the current winword.exe processes running and then try again.
-
try with wdo.ActiveDocument.PrintOut False
HTH
Sai
Subject: RE: About Automation Object Error During Word Document Print
I have try all these instruction thanx. But error is stills not remove. Is there any need to install API or some component to solve these problem? Is there any other way to print word file using agent ?
Subject: About Automation Object Error During Word Document Print
There is a space in "C:\ Sample1.doc"Maybe that shouldnt be there?
Subject: RE: About Automation Object Error During Word Document Print
I Have checked, There is No Space In “C:\Sample1.doc”.
Same Code is well Run On R6.5. On R6.5 it does not show me such type of error. It only occured on R7. Does there is any different between print command on R6 & R7.
Subject: RE: About Automation Object Error During Word Document Print
The version of notes doesn’t matter because it is the word object you are dealing with.Maybe the print command could be different in different word versions but i dont think it is.
I copied your code into an action and it works fine for me.
The only modification i did was change the path to a file i have and removed the line where you set the printer.
But, as you say, the error occur at the line where you try to open the file… can you open it manually?
Subject: RE: About Automation Object Error During Word Document Print
It work manually well. But during run in agent, error has occured. Is it there need to install API or some other component to solve such error ? Is There Any Anather Method To Print Word File Through Code? If So Please Tell Me.