GregM
01-18-2005, 09:11 AM
My macro works fine {except} when the sheet that is named and saved is reopened for future editing the locked cells can be selected. My original template still works fine though.
The cells are still locked and cannot be edited but should not be selectable. I verify that the sheet is still protected.
I unprotect it and re-protect it to find the SELECT LOCKED CELLS is enabled or set to TRUE.
Somehow I presume I need to set SELECT LOCKED CELLS to off or false.
Also, I had seen earlier in my search where someone was using a text file to maintain the counter data (I can't find that thread anymore though). If someone could share with me how to do that I'd be grateful.
Any help to get me beyond this hump will be greatly appreciated.
Best regards, GregM
Sub saving()
Dim tempName As String
tempName = ActiveWorkbook.Name
If tempName <> "!PAGE ONE_InvTemplate.xls" Then
Exit Sub
End If
' Sheets("Simple Invoice").Protect userinterfaceonly:=True
ActiveSheet.Unprotect Password:="x"
[M12].Value = [M12].Value + 1
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.Protect Password:="x"
Range("C9").Select
Application.DisplayAlerts = False
ThisWorkbook.SaveAs ("C:\Documents and Settings\Marisa\Desktop\Invoices\!PAGE ONE_InvTemplate.xls")
Application.DisplayAlerts = True
Dim invName As String
invName = InputBox("What is the Invoice Name?")
Range("C9").Value = invName
invName = invName + "_" + CStr([M12].Value)
ThisWorkbook.SaveAs ("C:\Documents and Settings\Marisa\Desktop\Invoices\" & invName & ".xls")
End Sub
The cells are still locked and cannot be edited but should not be selectable. I verify that the sheet is still protected.
I unprotect it and re-protect it to find the SELECT LOCKED CELLS is enabled or set to TRUE.
Somehow I presume I need to set SELECT LOCKED CELLS to off or false.
Also, I had seen earlier in my search where someone was using a text file to maintain the counter data (I can't find that thread anymore though). If someone could share with me how to do that I'd be grateful.
Any help to get me beyond this hump will be greatly appreciated.
Best regards, GregM
Sub saving()
Dim tempName As String
tempName = ActiveWorkbook.Name
If tempName <> "!PAGE ONE_InvTemplate.xls" Then
Exit Sub
End If
' Sheets("Simple Invoice").Protect userinterfaceonly:=True
ActiveSheet.Unprotect Password:="x"
[M12].Value = [M12].Value + 1
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.Protect Password:="x"
Range("C9").Select
Application.DisplayAlerts = False
ThisWorkbook.SaveAs ("C:\Documents and Settings\Marisa\Desktop\Invoices\!PAGE ONE_InvTemplate.xls")
Application.DisplayAlerts = True
Dim invName As String
invName = InputBox("What is the Invoice Name?")
Range("C9").Value = invName
invName = invName + "_" + CStr([M12].Value)
ThisWorkbook.SaveAs ("C:\Documents and Settings\Marisa\Desktop\Invoices\" & invName & ".xls")
End Sub