Microsoft Office Tutorials and References
In Depth Information
PowerPoint Procedures
PowerPoint Procedures
By Bill Dilworth
Inserting a Predefined Number of Slides
This procedure adds a specified number of slides to the active presentation.
Example file:
Scenario: Adding new slides, all at once, is often necessary
when building a presentation. Use this macro to insert many
blank slides at once, a procedure that can be done
manually—one at a time—by hitting Insert | New Slide.
View the Appendix to learn how to store this procedure
in a Standard module.
Option Explicit¶
' * * * * *¶
Sub BigInsert()¶
'Variable declaration¶
Dim intInsertCount As Integer¶
Dim strInsertCount As String¶
Dim i As Integer¶
'The default number of slides to display¶
strInsertCount = InputBox("How many slides?", _¶
"Bulk Insert Macro", "3")¶
If IsNumeric(strInsertCount) Then¶
intInsertCount = Val(strInsertCount)¶
'If the user removes the 3 or replaces with text¶
'the macro tells the user there’s a problem¶
MsgBox "Input not understood.", vbOKOnly, "Error"¶
'...and exit the macro¶
Exit Sub¶
End If¶
'Check to make sure the number is valid¶
If intInsertCount <= 1 Then¶
'Number is too low¶
MsgBox "Enter a number higher than 1", vbOKOnly, _¶
"Number Too Low Error"¶
Exit Sub¶
End If¶
If intInsertCount > 100 Then¶
Search JabSto ::

Custom Search