C# and Power Point
-
Hello, This may be more of a PowerPoint issue that a C# one, but I thought I would try it this way since I cannot find a PowerPoint solution for this. I have written a C# application that calls PowerPoint slides from a menu. I would like to know if there is a way to randomly change the background of each PowerPoint slide that is called by selecting the graphic from a list of possibles. I cannot find a way to do this in PowerPoint alone and I wondered if there was a way to have C# do it for me; or perhaps if there is another solution? Thanks for your thoughts....Best, Pat
-
Hello, This may be more of a PowerPoint issue that a C# one, but I thought I would try it this way since I cannot find a PowerPoint solution for this. I have written a C# application that calls PowerPoint slides from a menu. I would like to know if there is a way to randomly change the background of each PowerPoint slide that is called by selecting the graphic from a list of possibles. I cannot find a way to do this in PowerPoint alone and I wondered if there was a way to have C# do it for me; or perhaps if there is another solution? Thanks for your thoughts....Best, Pat
You are right. This is nothing at all to do with C#. I would suggest that a possible solution would be to use VBA to randomly choose the background and apply it.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
You are right. This is nothing at all to do with C#. I would suggest that a possible solution would be to use VBA to randomly choose the background and apply it.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
Ok Pete....just did not know where to turn on this one so I took a shot. The good news is that your suggestion worked; I was able to modify some VBA code I found and make it work along the following lines (even though I have never written a word in VB before): 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) = "pic1.JPG" PictureList(2) = "pic2.JPG" PictureList(3) = "pic3.JPG" PictureList(4) = "pic4.JPG" PictureList(5) = "pic5.JPG" PictureList(6) = "pic6.JPG" PictureList(7) = "pic7.JPG" PictureList(8) = "pic8.JPG" PictureList(9) = "pic9.JPG" PictureList(10) = "pic10.JPG" 'Define a slide 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((20 * Rnd) + 1) ' Don't follow the master background style mySlide.FollowMasterBackground = msoFalse mySlide.Background.Fill.UserPicture (PictureList(PictureChoice)) 'Use our random number to choose a picture from the list Next mySlide End Sub Thanks...Pat
-
You are right. This is nothing at all to do with C#. I would suggest that a possible solution would be to use VBA to randomly choose the background and apply it.
Forgive your enemies - it messes with their heads
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
:thumbsup: good advice!
Craigslist Troll: litaly@comcast.net "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson