Matyo

Replace an image (or audio) A with an image (or sound) B that retains the effect in powerpoint

7 posts in this topic

#1 ·  Posted (edited)

Hello everybody,

I'm trying to try to replace an image A (or an audio A) with an image B (or a sound B ) that still has the same effects (properties, ..) set earlier in a silde's powerpoint without knowing how?

Describe in the attached picture.

Please help everyone.

Thanks everyone!

 

2017-09-24_22-59-37.png

2017-09-24_22-59-25.png

Edited by Matyo

Share this post


Link to post
Share on other sites



Well, from what quick research I did, it looks possible using VBA, so I would suspect you could use PowerPoint COM to accomplish the tasks.  I'd recommend finding a piecemeal way to accomplish what you want using VBA first, then port the code to AutoIt (that's how I'd approach it).

Share this post


Link to post
Share on other sites

I haven't found a way to replace a picture/sound file with another file and keep all properties. The properties are gone when deleting the original picture/sound file.

@spudw2k
Can you please post a link to one of the VBA examples you mention?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

This was he first one I found: https://social.msdn.microsoft.com/Forums/en-US/39eb7cf4-2e85-4010-8e6a-10da20b352f7/replacing-changing-the-pictures-in-powerpoint-presentation?forum=isvvba

I notice in this example it's not doing a straight swap, but it is capturing properties (specifically location and size) and re-assigning them to the new image.  What properties are you talking about?  

1 person likes this

Share this post


Link to post
Share on other sites

That's the post I found as well. All other results presented by Google did the "swap" the same way - means they loose all properties the script does not save in advance and sets them after inserting the new shape.
There are a lot of properties you can set for a shape as described on MSDN.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
6 hours ago, spudw2k said:

This was he first one I found: https://social.msdn.microsoft.com/Forums/en-US/39eb7cf4-2e85-4010-8e6a-10da20b352f7/replacing-changing-the-pictures-in-powerpoint-presentation?forum=isvvba

I notice in this example it's not doing a straight swap, but it is capturing properties (specifically location and size) and re-assigning them to the new image.  What properties are you talking about?  

Hi Spudw2k,

Is there no way to replace it directly? An object has a lot of attributes such as effects, animation, order of presentation ... so go set up each component attribute, I think not perfect.

Share this post


Link to post
Share on other sites

Use the AddPicture method to add the picture. Set LinkToFile to msoTrue and SaveWithDocument to msoFalse. Replace the file with the new picture (the name needs to remain unchanged) and you are set.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now