Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing Word
Message
From
29/03/2000 11:51:02
 
 
To
29/03/2000 10:23:26
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Miscellaneous
Thread ID:
00352065
Message ID:
00352175
Views:
18
>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
Map
View

Click here to load this message in the networking platform