Printing from very hidden excel sheets

dss28

Board Regular
Joined
Sep 3, 2020
Messages
165
Office Version
  1. 2007
Platform
  1. Windows
In my workbook, I have several sheets which contain different forms and where the data is populated through vba program.
I am able to print these forms only when the sheets are made visible, if very hidden the printing is not possible.
I am adding thisworkbook.sheets("sheetname").activate command in each printing code but not working with veryhidden sheets.

any suggestions please to print from veryhidden sheets.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
You have to unhide them first by setting the visible property to xlsheetvisible
 
Upvote 0
thanks for the same. however when I use the below code, the hidden sheet is displayed at the back of the userform which looks unprofessional.
can you suggest better way / refined way in the coding.

Sheet "PrintReport" is veryhidden, I use a userform67 to transfer data from two textboxes to sheet "PrintReport" and then call a code to gather other data from master sheet using vlookup.


VBA Code:
Private Sub CommandButton1_Click() 


On Error Resume Next
' Application.ScreenUpdating = False

  ThisWorkbook.Sheets("PrintReport").Visible = xlSheetVisible   
 ThisWorkbook.Sheets("PrintReport").Activate

With Sheet14               


.Range("D11:P16") = ""           
.Range("O8") = ""
.Range("K8") = ""
.Range("F18") = ""

.Range("D36:P41") = ""   
.Range("O33") = ""
.Range("F43") = ""
  
          
        ThisWorkbook.Sheets("PrintReport").Range("O8").Value = UserForm67.TextBox1.Text           

        ThisWorkbook.Sheets("PrintReport").Range("K8").Value = UserForm67.TextBox2.Text           
        
 
    Call OfflinePrint     ‘ code to transfer data from master data sheet to sheet14 for printing
 
   ThisWorkbook.Sheets("PrintReport").Visible = False
  
 
       Unload UserForm67

 On Error Resume Next
 
    Application.Dialogs(xlDialogPrinterSetup).Show
    
    ActiveSheet.PrintOut       
  
        End With
        
        ThisWorkbook.Sheets("Welcome").Activate

 
   Application.ScreenUpdating = True
 
 
End Sub
 
Upvote 0
You should be turning off screenupdating
 
Upvote 0
Solution

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top