Mike Lewis
Programmer
I am trying to do a Word mailmerge. I want to send the merged output to the printer, without user interaction.
This is my code (with non-essential stuff removed for clarity):
This works OK, except for one detail. Because the mailmerge destination is the printer, Word opens it Printer dialogue so that the user can select the printer.
The trouble is that I am running this code with Word invisible. This means the user cannot see the dialogue and so the application appears to hang. In any case, I don't need the user to pick the printer, because I always want to use a specific printer.
My question is: How can I prevent Word displaying its printer dialogue during a mailmerge? I have tried setting the application object's ActivePrinter property, and have also set DisplayAlerts to 0, but these do not solve the problem.
Thanks in advance.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
My Visual FoxPro site: www.ml-consult.co.uk
This is my code (with non-essential stuff removed for clarity):
Code:
thisform.oDoc.MailMerge.OpenDataSource(lcDataFile)
thisform.oDoc.Mailmerge.Destination = 1
&& 1 here means send mailmerge to the printer
thisform.oDoc.Mailmerge.Execute
This works OK, except for one detail. Because the mailmerge destination is the printer, Word opens it Printer dialogue so that the user can select the printer.
The trouble is that I am running this code with Word invisible. This means the user cannot see the dialogue and so the application appears to hang. In any case, I don't need the user to pick the printer, because I always want to use a specific printer.
My question is: How can I prevent Word displaying its printer dialogue during a mailmerge? I have tried setting the application object's ActivePrinter property, and have also set DisplayAlerts to 0, but these do not solve the problem.
Thanks in advance.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
My Visual FoxPro site: www.ml-consult.co.uk