Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-24-2019, 06:28 AM
GregT GregT is offline Print hidden sheets Windows 10 Print hidden sheets Office 2016
Novice
Print hidden sheets
 
Join Date: Nov 2019
Posts: 3
GregT is on a distinguished road
Default Print hidden sheets

Hi all,

I am no whiz at excel and the code here, I used from another program. Can some please add the code to this string or tell me how to do it, Please.


I have a workbook with 4 sheets - 2 are hidden. The following code I am using works with the hidden sheet.

The problem is when I protect the sheets and workbook I get an error when I try to print the protected sheet or workbook. Can you suggest a workaround? Also I would like to view before print if that is possible...

TIA GT
----------------------------------------------------------------

Sub PrintSpecificSheet()
Dim wks As Worksheet

Set wks = ActiveWorkbook.Sheets("Printout")
If wks.Visible <> xlSheetVisible Then
Application.ScreenUpdating = False
wks.Visible = xlSheetVisible
wks.PrintOut
wks.Visible = xlSheetHidden
Application.ScreenUpdating = True
Else
wks.PrintOut
End If
Set wks = Nothing
End Sub
Reply With Quote
  #2  
Old 11-24-2019, 08:28 AM
Logit Logit is offline Print hidden sheets Windows 10 Print hidden sheets Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
You need to first unprotect the sheet/s ... do the printing ... then protect the sheet/s again.
Reply With Quote
  #3  
Old 11-24-2019, 09:28 AM
GregT GregT is offline Print hidden sheets Windows 10 Print hidden sheets Office 2016
Novice
Print hidden sheets
 
Join Date: Nov 2019
Posts: 3
GregT is on a distinguished road
Default

Yes thanks I understand that. However I am looking for the code to add to the one I am using (shown in the post) that WILL automatically unlock, preview, print, and lock again.


Reply With Quote
  #4  
Old 11-24-2019, 10:09 AM
Logit Logit is offline Print hidden sheets Windows 10 Print hidden sheets Office 2007
Expert
 
Join Date: Jan 2017
Posts: 529
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
ActiveSheet.Unprotect "pwd" '<--=- replace pwd with your actual password in quotes.

ActiveSheet.Protect "pwd"
Reply With Quote
  #5  
Old 11-24-2019, 01:04 PM
GregT GregT is offline Print hidden sheets Windows 10 Print hidden sheets Office 2016
Novice
Print hidden sheets
 
Join Date: Nov 2019
Posts: 3
GregT is on a distinguished road
Default

Quote:
Originally Posted by Logit View Post
.
ActiveSheet.Unprotect "pwd" '<--=- replace pwd with your actual password in quotes.

ActiveSheet.Protect "pwd"
Thanks!! will give this a try.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
One veryhidden sheet, one hidden sheet and two visible sheets - how to saveas into .xlsm workbook kiwimtnbkr Excel Programming 4 06-26-2019 11:30 AM
Print hidden sheets How can set a command to print only specific sheets? terrymac Excel Programming 2 12-01-2015 05:29 PM
Print hidden sheets Print Area - setting Print Area on large sheets nfotx Excel 2 12-27-2014 10:21 PM
Print Multiple Sheets Double-Sided flambe99 Excel 1 03-12-2010 01:15 PM
Print with hidden cols? markg2 Excel 2 01-06-2010 06:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft