Prev: Some chart types cannot be combined with other chart types?
Next: Video from one slide is embedding itself into another slide
From: Tony on 7 Dec 2009 18:38 The code below defines an array of pictures that are in the same directory as the powerpoint, then chooses a random picture from the list for the background of every slide. Public Sub ChangeBackgrounds() 'Global array to store pic names Dim PictureList(1 To 10) As String 'List of pictures - in same directory as ppt: PictureList(1) = "048.JPG" PictureList(2) = "049.JPG" PictureList(3) = "050.JPG" PictureList(4) = "051.JPG" PictureList(5) = "052.JPG" PictureList(6) = "053.JPG" PictureList(7) = "054.JPG" PictureList(8) = "046.JPG" PictureList(9) = "047.JPG" PictureList(10) = "059.JPG" Dim mySlide As Slide 'Iterate through every slide in the presentation For Each mySlide In ActivePresentation.Slides.Range Dim PictureChoice 'Give us a random number between 1 and 10 as PictureChoice PictureChoice = Int((10 * Rnd) + 1) mySlide.FollowMasterBackground = msoFalse ' Don't follow the master background style mySlide.Background.Fill.UserPicture (PictureList(PictureChoice)) 'Use our random number to choose a picture from the list Next mySlide End Sub robbi wrote: Random Background with VBA 15-Oct-08 Hi all, I would like to set up my presentation to choose between a set of random background images when changing slides. I'd like to test for a particular layout first and if it passes, then change the slide background. By testing for the layout, I can make sure the art set is consistent among that set of slides. So, is this possible? I can't seem to find a way to set the background for a slide via VBA. Any help is appreciated, thanks. robbie Previous Posts In This Thread: On Wednesday, October 15, 2008 4:11 PM robbi wrote: Random Background with VBA Hi all, I would like to set up my presentation to choose between a set of random background images when changing slides. I'd like to test for a particular layout first and if it passes, then change the slide background. By testing for the layout, I can make sure the art set is consistent among that set of slides. So, is this possible? I can't seem to find a way to set the background for a slide via VBA. Any help is appreciated, thanks. robbie On Wednesday, October 15, 2008 5:10 PM Edwar wrote: Assuming you want change the background for slide 1ActivePresentation. Assuming you want change the background for slide 1 ActivePresentation.Slides(1).Design.TitleMaster.Background.Fill.UserPicture (PicPath) -- Best regards, Edward "robbie" wrote: On Thursday, October 16, 2008 4:46 AM john AT technologytrish.co DOT uk wrote: RE: Random Background with VBA If that code fails you may also need to use: Activepresentation.Slides(1).FollowMasterbackground=msoFalse -- Amazing PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html _______________________________ "Edward" wrote: On Saturday, October 18, 2008 12:03 PM Steve Rindsberg wrote: And if *that* fails, try SlideMaster instead of TitleMaster ;-)In article And if *that* fails, try SlideMaster instead of TitleMaster ;-) In article <DABEE443-4AA8-484B-B4B7-FC5DE12FC1C3(a)microsoft.com>, John Wilson wrote: ----------------------------------------- Steve Rindsberg, PPT MVP PPT FAQ: www.pptfaq.com PPTools: www.pptools.com ================================================ Submitted via EggHeadCafe - Software Developer Portal of Choice XML into Data Islands Direct from SQL Server 2000 http://www.eggheadcafe.com/tutorials/aspnet/e67c85a7-bbaf-4a19-ab8b-bd916321c72a/xml-into-data-islands-dir.aspx |