Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2007 Select a Printer using VBA

Status
Not open for further replies.

Gazatron

Technical User
Jan 22, 2009
1
GB
Hi

I have inherited a database from my predecessor which uses some unclear vba. I'm not the most experienced myself so would really appreciate any help on this.

Basically a series of functions have been created to automatically create a mail merge document. Once the document has been opened and merged, it is the printed before being closed.

This section is supposed to change the printer setting for the document to the printer name held in the "StrPrinter" variable without changing the default printer before finally printing the document. I have checked the code step by step and it does run through all the lines, the variable also holds the printer name, however, the default printer is still used.

If StrPrinter <> "" Then
With wordApp.Dialogs(97)
.Printer = StrPrinter
.DoNotSetAsSysDefault = True
.Execute
End With
End If
WordDocM.PrintOut


We have recently upgraded to Office 2007 which I believe may have contributed to the problem. I am faitly sure it is just a case of dated code due to the new ribbon system of Word 2007, however, I dont know enough about word 2007 vba to resolve the problem myself.

If anyone could help with this coding I would be very grateful.

Thanks

Gareth
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top