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.
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.