Printing a hidden sheet

  • Thread starter Thread starter sungen99
  • Start date Start date
S

sungen99

The below macro works just fine when the worksheet is not hidden. But
when it is the macro bombs out.




Sub Button11_Click()
Sheets("Print Ticket").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Form").Select
Range("E9:F9").Select
End Sub
 
Sheets("Print Ticket").PrintOut Copies:=1, Collate:=True

This line alone should do the trick
 
sungen99 said:
The below macro works just fine when the worksheet is not hidden. But
when it is the macro bombs out.




Sub Button11_Click()
Sheets("Print Ticket").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Form").Select
Range("E9:F9").Select
End Sub

try unhiding the sheet whilst it is printed and then hiding it again

E.g

Sub Button11_Click()
sheets("print ticket").visible = xlsheetvisible
Sheets("Print Ticket").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
sheets("print ticket").visible = xlsheetveryhidden
Sheets("Form").Select
Range("E9:F9").Select
End Sub

hope this helps
 
Hi Sungeri,

Try removing the selection:

Sub Button11_Click()
Sheets("Print Ticket")..PrintOut Copies:=1, Collate:=True
End Sub

Selections are rarely necessary and are often inefficient.
 
try this from anywhere in the workbook. Selections are NOT necessary.

Sub printhiddensheet()
Application.ScreenUpdating = False
With Sheets("sheet8")
.Visible = True
.PrintOut
.Visible = False
End With
Application.ScreenUpdating = True
End Sub
 

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

Similar Threads


Back
Top