Hi,
I have a MsgBox displaying a user selected filepath with OK and Cancel options. IF OK is selected, the code continues. IF Cancel is selected the code loops back for the user to reselect the filepath.
I would like: IF the MsgBox is closed (using the red cross in the top right corner) then 'Exit Sub'.
Below is my current guess using 'vbAbort' for the closing option. However when i click the red cross the code loops back to line 23, as when i click 'Cancel'. How do I achieve what i want?
Thanks
I have a MsgBox displaying a user selected filepath with OK and Cancel options. IF OK is selected, the code continues. IF Cancel is selected the code loops back for the user to reselect the filepath.
I would like: IF the MsgBox is closed (using the red cross in the top right corner) then 'Exit Sub'.
Below is my current guess using 'vbAbort' for the closing option. However when i click the red cross the code loops back to line 23, as when i click 'Cancel'. How do I achieve what i want?
Thanks
Code:
foldername1 = "C:\\"
23
foldername = GetFolder(foldername1, "Select Filepath") 'lets user select filepath
MsgBoxOpt = MsgBox("Continue using File Path Below?" & vbNewLine & vbNewLine & foldername, vbOKCancel, "FilePath Check")
If MsgBoxOpt = vbCancel Then
GoTo 23
ElseIf MsgBoxOpt = vbAbort Then
Exit Sub
Else
End If