How do I print via macro on a protected worksheet

ghrek

Active Member
Joined
Jul 29, 2005
Messages
261
HI

I have a protected worksheet as I do not want people to put data in certain cells.

What I'm trying to do is set up a print macro but it will not let me print as it states the workbook is protected. Is there anyway I can print a certain area via macro without compromising unprotecting my book and everyone seeing the password.

Any ideas?
 

Some videos you may like

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,025
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
You will need to include the unprotect into your print code......execute the code then reprotect the worksheet / workbook
 

rollis13

Active Member
Joined
Jul 30, 2012
Messages
414
Office Version
  1. 2016
Platform
  1. Windows
@Michael M, that means he will have to hard-code his password and I think that's what he wants to avoid.
Maybe he could also protect his Project to avoid showing the code.
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,025
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
@rollis13
Correct, but as you mentioned, protecting the project will stop anyone from seeing the password....not really any other alternative... :cool: :cool:
 

ghrek

Active Member
Joined
Jul 29, 2005
Messages
261

ADVERTISEMENT

Sorry so you saying protect the project? How do you do that?
 

rollis13

Active Member
Joined
Jul 30, 2012
Messages
414
Office Version
  1. 2016
Platform
  1. Windows
VBA menu Tools / Options / Protection, this will 'hide' your macros. Be aware, if you forget this password it wouldn't be easy to retrieve.
 
Solution

rollis13

Active Member
Joined
Jul 30, 2012
Messages
414
Office Version
  1. 2016
Platform
  1. Windows
I'm glad I've been of some help(y).
 

Watch MrExcel Video

Forum statistics

Threads
1,127,082
Messages
5,622,567
Members
415,907
Latest member
Walters87

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