Unprotect Workbook in a Macro

LauraEFord

New Member
Joined
May 13, 2014
Messages
5
How do you turn off the the protection on workbook in a Macro? Using Outlook 2013

I have a macro that after I lput in my passwork and run the macro, it takes the protected file, removes links, removed data, and saves a stripped down version of the data. My issues is when the other users get the file, the password is still needed. Below is the code of I have come up with using excel and Mr. Excel msg board. Can someone tell me the proper syntex?

'unprotect sheet
ActiveWorkbook.Unprotect Password:="prodexecdoc"

Thank you
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
How do you turn off the the protection on workbook in a Macro? Using Outlook 2013

I have a macro that after I lput in my passwork and run the macro, it takes the protected file, removes links, removed data, and saves a stripped down version of the data. My issues is when the other users get the file, the password is still needed. Below is the code of I have come up with using excel and Mr. Excel msg board. Can someone tell me the proper syntex?

'unprotect sheet
ActiveWorkbook.Unprotect Password:="prodexecdoc"

Thank you

I would think that your choice is to furnish the password to other users, or send them an unprotected file.
 
Upvote 0
Yes, I would like to send them the file unprotected. The second option would be to send them a password protected file with a different password.
 
Upvote 0
Can somene tell me the macro code that would turn off the password protection on the newly saved file?


OR My second option I would have would be to give the new file a new password. What would line of code be?
 
Upvote 0
Can somene tell me the macro code that would turn off the password protection on the newly saved file?


OR My second option I would have would be to give the new file a new password. What would line of code be?

This unprotects the workbook, not the sheet.
unprotect sheet
ActiveWorkbook.Unprotect Password:="prodexecdoc"
For the sheet
Code:
ActiveSheet.Unprotect Password:=(If there is a password for the sheet)
Then make sure the file is saved while unprotected.
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,615
Members
449,322
Latest member
Ricardo Souza

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