Jump to content
Sign in to follow this  
IndianaGuy

Uprotect a Workbook

Recommended Posts

How do I turn off a password protected workbook. Obviously I have the password. I am trying to make a copy of the protected workbook and make the new copy unprotected. Thank you very much

	set xlApp = CreateObject("Excel.Application")
	Set objWorkbook = xlApp.Workbooks.Open("C:\mypath\..\..\protected.xlsx")
	xlApp.Visible=TRUE
   
	Set targetSchedule = xlApp.Workbooks(1)
	targetSchedule.SaveAs ("C:\mypath\..\..\..\uprotected_copy.xlsx")
	Dim myPass
	myPass = "12345678" 
	targetSchedule.Unprotect password:=myPass
	
Edited by IndianaGuy

Share this post


Link to post
Share on other sites

It might be syntax related, the line where you're calling unprotect looks a little strange.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×