Alphacsulb
Active Member
- Joined
- Mar 20, 2008
- Messages
- 414
Code:
Private Sub Workbook_Open()
If ThisWorkbook.Name <> "2 CITY Invoice MASTER 2011 NEW - Copy - Back Up.xls" Then Exit Sub
'Retrieve file name to use for Save
fileSaveName = Application.GetSaveAsFilename( _
fileFilter:="Excel Files (*.xls), *.xls")
'If user specified file name, perform Save and display msgbox
If fileSaveName <> False Then
ActiveWorkbook.SaveAs Filename:=fileSaveName, FileFormat:=xlNormal
MsgBox "Save as " & fileSaveName
End If
Windows(fileSaveName).Activate
ActiveSheet.Unprotect
End Sub
My code says, if the name of this worksheet is "2 CITY Invoice MASTER 2011 NEW - Copy - Back Up.xls" then prompt to SaveAs.
Then in a message box tell me where I saved the new file.
Then I want to Unprotect the new file that was "Saved As", but I get an error on the Windows(fileSaveName).Activate line.
If I remove this line then it unprotects my original document not the new one. It's probably an easy fix but I can't figure it out.