flashmpx
12-08-2011, 04:00 PM
Hi,
I would like to sort slides based on comparisons.
For example, let's say I have Slide A with Title 'ABCD' in a 44 page powerpoint present. I would like to look at the Title of every single slide, and IF it finds Slide B with Title 'XYZ', to move Slide A before Slide B.
Is this possible?
I've managed to find and modify some VBA code. However, when I execute it, it moves Slide "ABCD - Initiation" as the slide of the 44 page deck, when in reality, I want to move it after Slide "ISAC - Initiation"
How can I modify the code to make it do what I ask in my first paragraph? Any help would be greatly appreciated.
Sub bbbelu_orst()
Dim SldNum As Integer
Dim ChngFlag As Boolean
Dim NumRuns As Integer
ChngFlag = False
With ActivePresentation
LoopBack:
For SldNum = 1 To .Slides.Count - 1
If .Slides(SldNum).Shapes.HasTitle = msoTrue And .Slides(SldNum + 1).Shapes.HasTitle = msoTrue Then
If CStr(.Slides(SldNum).Shapes.Placeholders(1).TextFrame.TextRange.Text = "ABCD – Initiation") > CStr(.Slides(SldNum + 1).Shapes.Placeholders(1).TextFrame.TextRange.Text = "ISAC - Initiation") Then
ChngFlag = True
.Slides(SldNum).MoveTo (SldNum + 1)
End If
End If
If .Slides(SldNum + 1).Shapes.HasTitle = msoFalse Then
.Slides(SldNum + 1).MoveTo SldNum
End If
Next SldNum
NumRuns = NumRuns + 1
If NumRuns > 1000 Then
If MsgBox("Extended duration. Continue?", vbYesNo) <> vbYes Then Exit Sub
NumRuns = 0
End If
If ChngFlag = True Then
ChngFlag = False
GoTo LoopBack
End If
End With
MsgBox "Done."
End Sub
I would like to sort slides based on comparisons.
For example, let's say I have Slide A with Title 'ABCD' in a 44 page powerpoint present. I would like to look at the Title of every single slide, and IF it finds Slide B with Title 'XYZ', to move Slide A before Slide B.
Is this possible?
I've managed to find and modify some VBA code. However, when I execute it, it moves Slide "ABCD - Initiation" as the slide of the 44 page deck, when in reality, I want to move it after Slide "ISAC - Initiation"
How can I modify the code to make it do what I ask in my first paragraph? Any help would be greatly appreciated.
Sub bbbelu_orst()
Dim SldNum As Integer
Dim ChngFlag As Boolean
Dim NumRuns As Integer
ChngFlag = False
With ActivePresentation
LoopBack:
For SldNum = 1 To .Slides.Count - 1
If .Slides(SldNum).Shapes.HasTitle = msoTrue And .Slides(SldNum + 1).Shapes.HasTitle = msoTrue Then
If CStr(.Slides(SldNum).Shapes.Placeholders(1).TextFrame.TextRange.Text = "ABCD – Initiation") > CStr(.Slides(SldNum + 1).Shapes.Placeholders(1).TextFrame.TextRange.Text = "ISAC - Initiation") Then
ChngFlag = True
.Slides(SldNum).MoveTo (SldNum + 1)
End If
End If
If .Slides(SldNum + 1).Shapes.HasTitle = msoFalse Then
.Slides(SldNum + 1).MoveTo SldNum
End If
Next SldNum
NumRuns = NumRuns + 1
If NumRuns > 1000 Then
If MsgBox("Extended duration. Continue?", vbYesNo) <> vbYes Then Exit Sub
NumRuns = 0
End If
If ChngFlag = True Then
ChngFlag = False
GoTo LoopBack
End If
End With
MsgBox "Done."
End Sub