Consulting

Results 1 to 3 of 3

Thread: "Get picture" dialog

  1. #1
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location

    "Get picture" dialog

    Hi, I'm sorting out a few bugs my Word 2010 macros whilst in lockdown !

    I use these lines of code to insert a picture, then go on to execute some other functions in VBA:

      With Dialogs(wdDialogInsertPicture)
        .Show
      End With
    All is well if I click OK on the dialog box, but if I hit Cancel VBA continues to execute and I want it to quit.

    How can I trap that condition please ?

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    That's as simple as:
    With Dialogs(wdDialogInsertPicture)
      If .Show = False Then Exit Sub
    End With
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Regular
    Joined
    Jul 2018
    Posts
    17
    Location
    Everything's simple when you know how
    Thank you for knowing how Paul
    Martin

Posting Permissions

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