Hi:
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)
.Show
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
With appropriate editing to point to your directory and file types then ...
Regards,
chris_bottomley
Open in new window