Consulting

Results 1 to 1 of 1

Thread: Check if User pressed cancel wdDialogFileSaveAs

  1. #1

    Check if User pressed cancel wdDialogFileSaveAs

    Hello,

    What it does: Currently I have a button on a word document that when pressed, opens the save as dialog with pre-populated filename.docm, and then opens an email in Outlook with the named document attached. If the user presses cancel instead of save, the document doesn't rename but still generates the email.

    What I want it to do: If the user presses cancel I want it to exit sub so the email does not generate.

    Figured out a solution

    Sub SaveAs2andEmail()
    With Dialogs(wdDialogFileSaveAs)
    .Name = "Job Request_" & ActiveDocument.ContentControls(1).Range.Text & "_" & ActiveDocument.ContentControls(3).Range.Text
    .Format = wdFormatXMLDocumentMacroEnabled
    If .Show = -1 Then
    GenerateEmail
    Else
    Exit Sub
    End If
    End With
    
    End Sub




    Last edited by sparky5106; 05-14-2020 at 06:52 PM. Reason: Found Solution

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •