S
Steve_n_KC
I am using the code listed below (Which works like a top thankyou! Got it
from here) to save a file with a new name based on User input into 2 Input
boxes.
Is there a line or 2 of code someone could help me with to exit the sub if
the user either doesn't enter a response into one of the Input Boxes or
selects Cancel?
I tried using a reapplied exit sub line from one of my borrowed Excel macros
but couldn't get it to work.
As it stands now, the macro executes anyway and I end up with a bad file
path or name.
Sub SAVENEW()
ActiveDocument.Shapes("Text Box 2").Select
Selection.Delete
Dim strFilename1 As String
Dim strFilename2 As String
Dim strFilename As String
strFilename1 = InputBox("Department Name MUST BE ....", "Enter Dept. Name")
strFilename2 = InputBox("OPL Title", "Enter Title")
strFilename = "L:\KCS LIBRARY\OPL\" & strFilename1 & "\" & strFilename2 &
".OPL.doc"
ActiveDocument.SaveAs strFilename
ActiveWindow.Caption = ActiveDocument.FullName
End Sub
from here) to save a file with a new name based on User input into 2 Input
boxes.
Is there a line or 2 of code someone could help me with to exit the sub if
the user either doesn't enter a response into one of the Input Boxes or
selects Cancel?
I tried using a reapplied exit sub line from one of my borrowed Excel macros
but couldn't get it to work.
As it stands now, the macro executes anyway and I end up with a bad file
path or name.
Sub SAVENEW()
ActiveDocument.Shapes("Text Box 2").Select
Selection.Delete
Dim strFilename1 As String
Dim strFilename2 As String
Dim strFilename As String
strFilename1 = InputBox("Department Name MUST BE ....", "Enter Dept. Name")
strFilename2 = InputBox("OPL Title", "Enter Title")
strFilename = "L:\KCS LIBRARY\OPL\" & strFilename1 & "\" & strFilename2 &
".OPL.doc"
ActiveDocument.SaveAs strFilename
ActiveWindow.Caption = ActiveDocument.FullName
End Sub