IndianaGuy Posted January 25, 2018 Share Posted January 25, 2018 (edited) 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 January 25, 2018 by IndianaGuy Link to comment Share on other sites More sharing options...
justsomeguy Posted January 25, 2018 Share Posted January 25, 2018 Maybe you can use this: https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/workbook-changefileaccess-method-excel Notice that SaveAs also has parameters for passwords: https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/workbook-saveas-method-excel There's also this: https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/workbook-unprotect-method-excel Link to comment Share on other sites More sharing options...
IndianaGuy Posted January 25, 2018 Author Share Posted January 25, 2018 wow!! I thought my issue was syntax related. This is going to be a disaster for me to figure out. lol Link to comment Share on other sites More sharing options...
justsomeguy Posted January 25, 2018 Share Posted January 25, 2018 It might be syntax related, the line where you're calling unprotect looks a little strange. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now