Jump to content

Uprotect a Workbook


IndianaGuy

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
Link to comment
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
×
×
  • Create New...