![]() |
|
#1
|
|||
|
|||
|
Hi
I am using VBA to copy over a range of workbooks to a new location. I want to clear the data from the worksheets which are password protected. I do know the password. Everything works okay until I insert ActiveSheet.Unprotect Password:="Test" then I get a subscript out of range message. Does anyone know how to get around this? Code:
Sub test()
Workbooks.Open Filename:="c:\Try this.xlsm", Password:="one", WriteResPassword:="two"
ChDir "c:\New\"
ActiveWorkbook.SaveAs Filename:= _
"C:\New\Try this 1.xlsm", FileFormat:= _
xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
ActiveSheet.Unprotect Password:="Test"
End Sub
|
| Tags |
| password, remove password |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Password protected file no longer offers password dialog on Open | htaylor | Word | 0 | 10-15-2013 12:35 PM |
How to summarise different worksheet to a summary worksheet
|
samkiewhock | Excel | 1 | 09-06-2012 03:34 AM |
Outlook requests password afeter changing windows password
|
pask | Outlook | 5 | 03-16-2012 08:43 AM |
Removing password protection
|
HantsDave | Word VBA | 9 | 03-08-2012 11:57 AM |
Trouble Removing Password
|
cure4glass | Word | 1 | 02-17-2012 07:19 PM |