General information
Category:
COM/DCOM and OLE Automation
>I believe the problem is in the 6th line of code there '.Quit'
>This closes the Word application and thusly, there is no way to open a >document. I believe all you wanted to do was close that initial document, and >instead you're quitting the entire word document. Try just using this
>.ActiveWindow.Close
So the code turned into this...
range = "999"
from = "1"
to = "999"
oword = CreateObject("Word.Application")
dimension filelist(1)
filecnt = adir(filelist, print_dir + alltrim(print_spec))
print_file = print_dir + filelist(n,1)
if filecnt > 0
for n = 1 to filecnt
WITH oword
.Documents.Open(print_file)
.ActiveDocument.PrintOut(0,0,range,"",from,to)
.ActiveWindow.Close
ENDWITH
*!*delete file (print_file)
endfor
endif
oword.Quit
The .ActiveWindow.Close doesn't close the current instance of Word for some reason. When I step through the process, he loops through and prints the first doc. At that point I had to remove the deletion of the doc because he looks for it because he seems to have the same instance of Word open. So I get a series now of the same doc printed repeatedly. The initial thought was a great call- Thanks... Now can ya help with some tweakin'?
Tom Welch
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only