Information générale
Catégorie:
COM/DCOM et 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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement