Print First Page VBA
Recently I answered a question regarding printing the first page of each sheet in Excel with VBA. I had never come across this problem before but enjoyed reaching the following solution.
The answer is a very simple procedure which will print the first page of each sheet in the workbook. The VBA code is as follows:
Sub PrintFirstPage() 'Excel VBA procedure to printout first page.
Dim sh As Worksheet
End Sub
If you wanted to print the first two sheets of each page you would change the code to the following.
sh.PrintOut 1, 2, 1, , , , True, , False
Where 2 is the character to change for the number of sheets to print out. Actually you can change the code to start or end from a different number of sheets. The first part after printout is the start number and the second part is the end number so
sh.PrintOut 5, 10, 1, , , , True, , False
means sheets 5-10 will be printed out.
The attached workbook shows how the Excel VBA procedure works on a sample data set.