Cancel of text box leaves sheet unprotected
Sub seeIfThishelps()
If MsgBox("Generate New System DMS?", _
vbYesNoCancel + vbQuestion, "Save As") < vbYes Then
MsgBox "This is what happens if user clicks no or cancel"
Exit Sub
End If
MsgBox "This is what happens if user clicks yes"
End Sub
"Steve_n_KC" wrote:
Macro I am using unprotects my sheet so that it can run then uses a msg box
followed by an info box entry as a component of the save name for a new file.
Problem happens when user tells the msg box no, OR cancels out of the info
box, Sheet is left unprotected. I have not been able to resolve myself or
piece together code from your answers to other questions to stop this problem.
Code I have is:
Sub saveit()
ActiveSheet.Unprotect Password:="'"
Sheets("dms wizard").Select
ActiveSheet.Unprotect Password:="'"
response = MsgBox("Generate New System DMS?" _
, vbYesNo, "Save As")
If response = 6 Then
Name = InputBox("Enter System Name", "Path Will Be L:\E&T Pillar\KCS
Library\DMS\<Dept Name\<System Name.DMS")
If Name = "" Then End
ActiveWorkbook.SaveAs Filename:="L:\E&T Pillar\KCS Library\DMS\" &
Range("C8").Value & "\" & Name & ".DMS.xls"
Can you help me reprotect in the event of a "no" or a cancel?
--
THANKS!
Steve
|