VBA & Macro Problems

How to Change the Picture for an Audio File in PowerPoint VBA

Camila MilosovichCamila Milosovich Nov 3, 2026 869 views

Question details

The user wants to programmatically change the visual icon of an inserted audio file in PowerPoint using VBA.

How to Change the Picture for an Audio File Using PowerPoint 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA Editor

Press ALT + F11 to open the VBA Editor in PowerPoint, and insert a new Module.

2
Define the Target Shape

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.

3
Save Original Coordinates

Store the current position and size of the shape in variables (e.g., sTop = oMed.Top, sLeft = oMed.Left).

4
Apply the New Picture

Call the method oMed.MediaFormat.SetDisplayPictureFromFile "C:\Path\To\Your\Image.png" to change the audio icon.

5
Restore Position

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.

Replace the Audio Icon using the MediaFormat Object
Avoid Transparency Workarounds: Attempting to layer a picture over the audio image and making the audio transparent is unreliable in VBA code. The SetDisplayPictureFromFile method is the officially supported and stable approach.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS Office website and click the free download button.
  2. 2. Install the Software: Run the installer and follow the simple on-screen instructions to complete the setup.
  3. 3. Open Your Presentation: Launch WPS Presentation and open your existing .pptx files directly with full formatting retained.
Fully compatible with Microsoft PowerPoint (.pptx, .ppt) and macro formats.Lightweight installation with extremely fast startup times.Familiar ribbon interface requires no learning curve.Rich library of free presentation templates and built-in design tools.
microsoft office alternative - wps office

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.