How to Set a PowerPoint Background from an Embedded Excel Picture Using VBA
Question details
The user wants to use VBA to set PowerPoint slide backgrounds using pictures that are embedded directly within an Excel workbook, without keeping permanent image files saved on the disk.

- Product
- Microsoft Excel / PowerPoint (VBA)
- Device & OS
- not provided
- Scenario
- Automating presentation creation by transferring images from Excel to PowerPoint backgrounds via VBA scripts.
- Observed behavior
- A method is needed to extract embedded Excel images, apply them as slide backgrounds in PowerPoint, and ensure no permanent files are left behind on the local drive.
Ensure you have enabled the Developer tab in Excel and have set the necessary reference to the Microsoft PowerPoint Object Library in your VBA editor.
Use VBA to Export to a Temporary File and Set as Slide Background
This approach extracts the image to a temporary file, sets it as the slide background, and then immediately deletes the file to keep your system clean.
Because the PowerPoint object model requires a physical file path to assign a user picture to a slide background, you cannot directly pass an image from system memory or the clipboard. Creating a temporary file is the most efficient workaround.
Press Alt + F11 in Excel to open the VBA Editor, then click Insert > Module to create a new script area.
Go to Tools > References in the top menu, scroll down, and check the box next to 'Microsoft PowerPoint Object Library'.
Write VBA code to copy the target Shape in Excel, paste it into an empty temporary Chart object, and use the Chart.Export method to save it as a temporary JPG in your local AppData or Temp folder.
Use PowerPoint VBA objects to set the background. For example, use Slide.Background.Fill.UserPicture("C:\Temp\temp.jpg") to point the slide background to your newly created temporary file.
Once the background is applied, use the VBA Kill statement (e.g., Kill "C:\Temp\temp.jpg") to permanently remove the temporary image file from your hard drive.

Automate Spreadsheets and Presentations with WPS Office Macros
WPS Office features a robust built-in Macro Editor that supports VBA, allowing you to seamlessly automate workflows like transferring images between WPS Spreadsheets and WPS Presentation.
- 1. Open WPS Spreadsheets: Launch WPS Office and open your workbook containing the embedded images you wish to export.
- 2. Access the Macro Editor: Navigate to the Tools tab on the top ribbon and click on 'Macro Editor' to launch the VBA-compatible scripting environment.
- 3. Run the Cross-App Macro: Paste and execute your VBA script to extract the embedded image, launch WPS Presentation, and set it as the slide background.
- 4. Save as Macro-Enabled Format: Go to Menu > Save As and select the highly compatible .xlsm format to retain your automated scripts for future use.

Frequently Asked Questions
Why can't I assign an Excel shape to a PowerPoint background directly from the clipboard?
The PowerPoint VBA API for setting user pictures (UserPicture) strictly requires a physical file path. It does not accept a clipboard object or an image directly from system memory, making the temporary file creation step mandatory.
How do I ensure the temporary file gets deleted even if the code crashes?
You should implement error handling in your VBA script using 'On Error GoTo' statements. In your error-handling block at the end of the script, include the 'Kill' command to safely delete the temporary file before the script entirely exits.
Is there a specific image format I should use for the temporary file?
JPG or PNG formats are highly recommended for the Chart.Export method. PNG is preferable if your embedded Excel images have transparency, ensuring the final PowerPoint slide background maintains high visual quality.




