Consulting

Results 1 to 3 of 3

Thread: Slideshow Shuffle/Randomizer keeps removing ALL background color

  1. #1
    VBAX Newbie
    Joined
    Jul 2017
    Posts
    2
    Location

    Question Slideshow Shuffle/Randomizer keeps removing ALL background color

    Hello.

    I have MS Office 2016. I made some PowerPoint flashcards for class, and I assigned a different background color for each chapter. I want the slides shuffled, so I used a "slideshow randomizer" macro I found online...but it removes ALL of the background colors.

    I discovered that if you manually cut a slide -- and then use Paste Special: Keep Source Formatting -- the slide remained unchanged. Is there a way to add this command to a macro?

    Here's the shuffle/randomizer code I've been using. I'm assuming the last line needs to be changed somehow.

    Thanks in advance for any help! :
    Sub sort_rand()
    'CODE TAKEN FROM: pptfaq. com/FAQ00429_Randomize_the_order_of_a_PowerPoint_presentation.htm
        Dim i As Integer
        Dim myvalue As Integer
        Dim islides As Integer
        islides = ActivePresentation.Slides.Count
        For i = 1 To ActivePresentation.Slides.Count
            myvalue = Int((i * Rnd) + 1)
            ActiveWindow.ViewType = ppViewSlideSorter
            ActivePresentation.Slides(myvalue).Select
            ActiveWindow.Selection.Cut
            ActivePresentation.Slides(islides - 1).Select
            ActiveWindow.View.Paste
        Next
    
    
    End Sub
    Last edited by just_bri; 07-27-2017 at 08:55 PM.

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    It is possible in 2016 to call Paste source format from vba but you would be better just moving slides.

    Sub Shuffle()
    Dim L As Integer
    Dim iCount As Integer
    Dim iFrom As Integer
    Dim iTo As Integer
    iCount = ActivePresentation.Slides.Count
     For L = 1 To iCount * 2
    Randomize
    iFrom = Int(Rnd * iCount) + 1
    Randomize
    iTo = Int(Rnd * iCount) + 1
    ActivePresentation.Slides(iFrom).MoveTo (iTo)
    Next L
    End Sub
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Newbie
    Joined
    Jul 2017
    Posts
    2
    Location
    Thanks! It works perfectly! I added your name + URL to the comments section of the macro, as thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •