Printing from very hidden excel sheets

dss28

Board Regular
Joined
Sep 3, 2020
Messages
102
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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,365
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You have to unhide them first by setting the visible property to xlsheetvisible
 

dss28

Board Regular
Joined
Sep 3, 2020
Messages
102
Office Version
  1. 2007
Platform
  1. Windows
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
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
37,365
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You should be turning off screenupdating
 
Solution

dss28

Board Regular
Joined
Sep 3, 2020
Messages
102
Office Version
  1. 2007
Platform
  1. Windows
thanks a lot
 

Forum statistics

Threads
1,141,715
Messages
5,708,027
Members
421,540
Latest member
quocbinh

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
Top