Reputation: 5470
I'm generating a PPT presentation through vba in excel, everything is working just fine except that Im being asked to automatically set background of the power point (which it wouldn't be much a problem) but this will be done with a picture that is actually embedded on the macro, so I dont have physical path to reference the picture, plus the excel is generated on the fly according to the user inputs.
so.. has anyone achieved this : Programmatically set a slide backrground from vba excel with a picture that is embedded on a sheet?
Thanks!
Upvotes: 3
Views: 7134
Reputation: 3528
If you can't find a way to set the background directly from a picture in memory, what about copy/pasting the picture from Excel into the Slide Master(s) in your PPT presentation then sending them to the back so they sit behind everything. The effect would be nearly identical from the user's point of view, I think.
Upvotes: 1
Reputation: 26591
As far as i understand, you want to set the background of the slides in vba (it doesn't matter it is called from Excel).
Let's assume you have the path in a var:
Dim osld As Slide
Set osld = ActivePresentation.Slides.Range 'every slides of the presentation
'This is important in some cases
osld.FollowMasterBackground = False
With osld.Background.Fill
.UserPicture <string var containing path to image>
End With
End Sub
You will also have to adapt ActivePresentation
with the PPT object you built from your previous code.
Upvotes: 4