MsgBox when selection is made

ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

MsgBox when selection is made

Post by ABabeNChrist »

I'm using this code to open a Save As dialog, I have an opening message before the code runs and a message at the end. is it possible that if the user decides to opt out and selects the cancel button on the Save As dialog, that the last message will not be displayed.

Code: Select all

MsgBox ("You are now starting a New Report. You can also opt to CANCEL this process")
Application.Dialogs(xlDialogSaveAs).Show arg2:=xlOpenXMLWorkbookMacroEnabled
MsgBox ("You may now select OPEN REPORT and begin working on your report")

User avatar
StuartR
Administrator
Posts: 12604
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: MsgBox when selection is made

Post by StuartR »

Code: Select all

If Application.Dialogs(xlDialogSaveAs).Show(arg2:=xlOpenXMLWorkbookMacroEnabled) Then
    ' More actions here
Else
    ' Actions for when the user cancelled
End If
StuartR


ABabeNChrist
SilverLounger
Posts: 1868
Joined: 25 Jan 2010, 14:00
Location: Conroe, Texas

Re: MsgBox when selection is made

Post by ABabeNChrist »

Thank you StuartR
It works perfect