Printing specific worksheet of Excel file from Visual Basic program

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
Can somebody help me to print a specific worksheet of an Excel file thru Visual Basic

Thank
Davy
 
Davy:
Davy said:
Hi!
Can somebody help me to print a specific worksheet of an Excel file thru Visual Basic?

Thanks
Davy

Try this:

Sub PrintSpecificSheet(ByVal i As Integer)
Sheets(i).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate _
:=True
End Sub

Where i is the Index of the sheet you want to print. you can overload this
to accept a String which could be the WorkSheet name, or you could just
change it to a string...

HTH,

Bill
 
Back
Top