I have a macro that changes the active printer and then runs a mailmerge. When the mailmerge is done, it runs a MailmergeAfterMerge event that unlinks the fields in the resulting document. I also want the event code to change the default tray for the printer. When I run the merge, it crashes when it gets to the code to change the default tray. If I don’t have that code to change the paper tray, it runs fine. If I run another macro to change the paper tray, that code runs just fine.
I think this is a timing issue because it may be trying to jump into the code before it is ready to execute it though I have moved the line around with no good result. Isn’t there a way to slow down the speed of the macro?
The code I use to change the printer in the starting macro is:
Application.WordBasic.fileprintsetup printer:= "\\and the name of print queue", DoNotSetAsSysDefault:=1
I use the above code so the default printer is not changed.
Then in the MailMergeAftermerge event code is:
Options.DefaultTray = "drawer 2(left deck)
I think this is a timing issue because it may be trying to jump into the code before it is ready to execute it though I have moved the line around with no good result. Isn’t there a way to slow down the speed of the macro?
The code I use to change the printer in the starting macro is:
Application.WordBasic.fileprintsetup printer:= "\\and the name of print queue", DoNotSetAsSysDefault:=1
I use the above code so the default printer is not changed.
Then in the MailMergeAftermerge event code is:
Options.DefaultTray = "drawer 2(left deck)