I have a workbook that is locked except for everything except viewing.. how do i allow for printing though?

kbishop94

Active Member
Joined
Dec 5, 2016
Messages
476
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Workbook is locked to limit anyone changing anything on it or anything else, other than viewing it. But, I do have 4 command buttons onthe worksheet. One is for printing the worksheet, 1 for zooming in, 1 for zooming out, and the last one for resetting the zoom so that it fillsthe screen.
With the workbook being locked, when you click on either of the command buttons, you (obviiously) get an error. What code do I need to insert so that it allows the functions each command button executes when selected? Thanks!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Sounds like you need to unprotect the sheet before your code does anything, then protect it again afterwards. Can it be as simple as that or have I misunderstood the question?

Googling excel vba protect unprotect should give you a clue (mrexcel.com was second in the search results when I did this), or you could start the Macro Recorder, unprotect and protect manually, then see what code is generated.
 
Upvote 0
Sounds like you need to unprotect the sheet before your code does anything, then protect it again afterwards. Can it be as simple as that or have I misunderstood the question?

Googling excel vba protect unprotect should give you a clue (mrexcel.com was second in the search results when I did this), or you could start the Macro Recorder, unprotect and protect manually, then see what code is generated.

Perfect! Thank you, Ruddles
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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