Setting Printer Options Programmatically

C

Chaplain Doug

Excel 2003. I am trying to create PDF files from each of the sheets in my
workbook. I am using the code:

Sub test()
Dim a As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
For a = 1 To ThisWorkbook.Worksheets.Count
ThisWorkbook.Sheets(a).Copy
Set wb = ActiveWorkbook
wb.PrintOut , , , , "Adobe PDF"
wb.Close False
Set wb = Nothing
Next a
Application.ScreenUpdating = True
End Sub

This works fine the first time I "print" to a PDF file, since I set the
printer not to prompt for file name, etc. However, when I move to the next
sheet the printer options have been reset. How may I set the options for the
printer programmatically before each .PrintOut? Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top