How to Change the Picture for an Audio File in PowerPoint VBA
Question details
The user wants to programmatically change the visual icon of an inserted audio file in PowerPoint using VBA.

- Product
- PowerPoint
- Device & OS
- not provided
- Scenario
- Customizing presentation elements via VBA where a default audio icon needs to be replaced with a custom image.
- Observed behavior
- The standard 'Change Picture' command is not exposed for audio icons in the PowerPoint VBA object model, requiring a specific workaround.
Ensure your PowerPoint presentation contains the target audio file and that you have the exact file path ready for the new image you want to use. Make sure the Developer tab is enabled to access the VBA editor.
Replace the Audio Icon using the MediaFormat Object
Utilize the SetDisplayPictureFromFile method of the MediaFormat object to update the audio icon while keeping the embedded audio intact.
Because PowerPoint VBA does not expose the standard 'Change Picture' command for audio shapes directly, you must interact with the MediaFormat object.
When you apply a new picture, the shape may shift or resize. It is highly recommended to store the original Top, Left, Width, and Height properties before swapping the image, and reapply them afterward.
Press ALT + F11 to open the VBA Editor in PowerPoint, and insert a new Module.
Declare a variable for your audio shape. For example: Set oMed = ActivePresentation.Slides(1).Shapes(1), assuming the audio file is the first shape on the first slide.
Store the current position and size of the shape in variables (e.g., sTop = oMed.Top, sLeft = oMed.Left).
Call the method oMed.MediaFormat.SetDisplayPictureFromFile "C:\Path\To\Your\Image.png" to change the audio icon.
Reapply the saved Top and Left coordinates to the shape (oMed.Top = sTop, oMed.Left = sLeft) to ensure the new icon remains in the correct place.

Try WPS Presentation for a Seamless Office Experience
WPS Office is a lightweight, highly compatible, and free alternative to Microsoft Office. It seamlessly opens, edits, and saves PowerPoint (.pptx) files, offering a familiar interface that makes migrating effortless.
- 1. Download WPS Office: Visit the official WPS Office website and click the free download button.
- 2. Install the Software: Run the installer and follow the simple on-screen instructions to complete the setup.
- 3. Open Your Presentation: Launch WPS Presentation and open your existing .pptx files directly with full formatting retained.

Frequently Asked Questions
Why can't I use the standard Change Picture command for audio shapes in VBA?
The PowerPoint VBA object model treats audio shapes differently than standard picture shapes. It does not expose the UI's 'Change Picture' command directly for audio; instead, you must use the MediaFormat object to manipulate its visual representation.
Will changing the display picture delete or mute my embedded audio?
No. Using the SetDisplayPictureFromFile method safely replaces only the visual icon. Your embedded audio file, along with its playback and animation settings, remains completely intact.
How do I resize the new audio icon in VBA after changing it?
After applying the new picture, you can modify the shape's .Width and .Height properties directly in your VBA code to scale the new icon appropriately.




