Log in

View Full Version : [SOLVED:] "Get picture" dialog



MartinGM
03-27-2020, 02:47 PM
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 ?

macropod
03-27-2020, 03:58 PM
That's as simple as:

With Dialogs(wdDialogInsertPicture)
If .Show = False Then Exit Sub
End With

MartinGM
03-29-2020, 03:09 PM
Everything's simple when you know how :devil2:
Thank you for knowing how Paul
Martin