We help IT Professionals succeed at work.
Get Started

Using VBA, how can I display an Insert Picture dialog in PPT 2007, pointing to a directory of my choice

Last Modified: 2012-05-09

Trying to build a macro in VBA, for use in Powerpoint, that presents an InsertPicture dialog pointing to a pre-determined folder.  I understand PPT does not give the same access to built-in dialog boxes I have in Word, but is there a workaround?

Here's the code I used to accomplished this in Word:

    Dim defpath As String
'Get the present default filepath for pictures
    defpath = Options.DefaultFilePath(wdPicturesPath)
'Change it to desired folder
    Options.DefaultFilePath(wdPicturesPath) = "C:\TemplateDemo\Graphics\"
    With Dialogs(wdDialogInsertPicture)
    End With
'Change the default filepath back to the original default
    Options.DefaultFilePath(wdPicturesPath) = defpath

I already tried substituting "pp.." for "wd..." but no such luck.

I also found online the following snippet which does display an insert picture dialog (pointing to the default "my pictures" location) in PPT 2007, but it was clearly coded for legacy versions.

Application.CommandBars("Menu bar").Controls("&Insert").Controls("&Picture").Controls("&From File...").Execute

I'd be happy to use this if I can control where it points.  

Any suggestions?

Thanks in advance
Watch Question
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE