shellexecute con word

124 views
Skip to first unread message

aurora baccio

unread,
Feb 15, 2021, 9:43:18 AMFeb 15
to
good morning.
in the production of prints from vo I use a lot of word through a procedure inherited from previous programmers called 'compile word'. I use this procedure mainly in the printing of certificates and invoices. The procedure is very valid and functional, but the problem is in the number of prints. If I want to print three copies of the same document I must use a loop for ...next.
The actual printing of the created word document is done through 'shellexecute'.
The help request is: is there an alternative procedure to use word indicating the number of copies to print?
Another question: is there a way to close word at the end of the printing with shellexecute?
thanks
Aurora Baccio

Wolfgang Riedmann

unread,
Feb 17, 2021, 11:29:37 AMFeb 17
to
Hi Aurora,

I don't know who you are using that.
If it is something I wrote years ago for a guy from Sicily (that in the
end called me a "razzista xenofobo"), then you have to rewrite that.
Are you compiling a RTF file and printing that?

Wolfgang
--

aurora baccio

unread,
Feb 23, 2021, 12:41:13 PMFeb 23
to
Mr. Riedman good evening,
sorry you had problems with a Sicilian.
I am Sicilian.
However I don't think it's the same procedure.
I directly compile a .doc file using a procedure of the type #variable name on the .doc file and I am told that the version was provided by a programmer from Latina who worked in the clinic for which I now work and from whom I inherited everything.
The problem is that for printing I have to use a script in php that prints word. This allows me to print the number of copies that I require, but slows down the application. Using shelexecute the difference is significant but it becomes a problem if you print multiple copies. It's as if word, at the end of the initial printing, doesn't get closed, and in the long run you have crashing problems. With the procedure in php I close word every time I finish printing.
I was wondering if there was a method to print a word file directly from vo for the number of copies you want.
only this.
thanks always
Aurora Baccio

JohnMartens

unread,
Feb 23, 2021, 12:52:53 PMFeb 23
to
Hope this can help you to get it done
John

DO WHILE (hWnd := FindWindow(NULL_PSZ, PSZ("Adobe Reader"))) = NULL_PTR
Sleep(500)
ENDDO
Sleep(5000)
// Close
PostMessage(hWnd, WM_CLOSE, 0, 0)





Op 15-2-2021 om 15:43 schreef aurora baccio:

Wolfgang Riedmann

unread,
Feb 24, 2021, 7:49:28 AMFeb 24
to
Buon giorno Aurora,

you can "drive" Word completely from VO using COM, as Word has a very
powerful API (like all the Office applications).
I'm using it in several projects not only to print, but also to fill
out fields.
And of course you can also close down it after use.

IMHO That would be the best option.
But I have to prepare a sample, if you need it.

Wolfgang

P.S. I have no problems at all with people because of their nationality
- your question about compilaWord only let me remember this person.
--

aurora baccio

unread,
Feb 26, 2021, 7:50:35 AMFeb 26
to
good morning,
let me understand.
after the line of shellexecute I must insert the lines from you suggested.
Simply. This closes the printing process.
Right?
Aurora Baccio

JohnMartens

unread,
Mar 1, 2021, 1:42:48 PMMar 1
to
That's what worked for me when I printed .PDF's with Adobe
Hope it will work for Word as well ...
john

Op 26-2-2021 om 13:50 schreef aurora baccio:
Reply all
Reply to author
Forward
0 new messages