Hello all,
I would like to be able to update the page number in a repeating print area and have a single printout command to produce a single pdf file. The print area is fixed and I know the number of pages (3). There is a cell where the user can input the first page number to be used.
Here is the code that I have been using.
Sub PrintPages()
Dim NumSheets As Double, FirstPageNum As Double, SheetNumOutput As Range
Set SheetNumOutput = myWorksheet.Range("I2")
NumSheets = 3
FirstPageNum = myWorksheet.Cells(11, 11) 'User inputs first page number.
For n = 1 To NumSheets
SheetNumOutput.Value = FirstPageNum + n - 1
myWorksheet.PrintOut n, n, 1, True
Next n
End Sub
The problem is that when I try to print to a pdf, I get separate printout for each page. I would like to have this functionality while printing to only one pdf file. This code works when I print to a regular printer, but not to a pdf creator.
Thanks,
Jeremy
I would like to be able to update the page number in a repeating print area and have a single printout command to produce a single pdf file. The print area is fixed and I know the number of pages (3). There is a cell where the user can input the first page number to be used.
Here is the code that I have been using.
Sub PrintPages()
Dim NumSheets As Double, FirstPageNum As Double, SheetNumOutput As Range
Set SheetNumOutput = myWorksheet.Range("I2")
NumSheets = 3
FirstPageNum = myWorksheet.Cells(11, 11) 'User inputs first page number.
For n = 1 To NumSheets
SheetNumOutput.Value = FirstPageNum + n - 1
myWorksheet.PrintOut n, n, 1, True
Next n
End Sub
The problem is that when I try to print to a pdf, I get separate printout for each page. I would like to have this functionality while printing to only one pdf file. This code works when I print to a regular printer, but not to a pdf creator.
Thanks,
Jeremy