Link to home
Start Free TrialLog in
Avatar of MadIce
MadIce

asked on

Replace picture in powerpoint using vba in access

I have a powerpoint Template that I want to be able to replace a picture depending on what a user selects. I know how to add a picture, but can't figure out a way to replace as oppose to add. I'm using Access to make changes to the template
any ideas... Thanks in advance
SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
MadIce,

So try to combine my code with the info in puppydogbuddy's link,

Since you stated that you already have some of the automation already:
<I'm using Access to make changes to the template>

JeffCoachman
Avatar of MadIce
MadIce

ASKER

boag2000:
So I guess you can't just select and replace. I've already setup my code to do the delete and add of the image. But looking at your example code, I think I'll change my a little. I like the idea of taking the size and coordinates of the current image and using it to set my new image. I'm having to resize the images to that original image anyways. So that will be useful. I'm going to split the points because both of you kind of answered the main part equally. But I'm going to give boag2000 more points because I'm going to use part of his example in my code. Hope that's fair.  Thanks
MadIce,

<So I guess you can't just select and replace.>
In order to "Select", you would have to list the Shapes in a Combobox.
You could modify the loop to accumulate the Shape names and display them in a combo box on a UserForm.:

Dim strPicNames As String
Dim shp As Shape
   
    For Each shp In ActiveWindow.Selection.SlideRange.Shapes
        strPicNames = strPicNames & shp.Name & ","
    Next shp
   
    strPicNames = Left(strPicNames, Len(strPicNames) - 1)

    MsgBox strPicNames


But then we are talking about building a Userform and all that comes along with doing that.


Good Luck!

JeffCoachman