PPT2000: Sample Code to Expand Slides
ID: Q240189
|
The information in this article applies to:
-
Microsoft PowerPoint 2000
SUMMARY
The Expand Slides feature, available in Microsoft PowerPoint 97, is no longer a part of PowerPoint 2000. This functionality is now part of the general advice given by the Microsoft Office Assistant as you create your presentation.
This is the only way in PowerPoint 2000 to gain access to the feature previously known as Expand Slides.
The sample code in this article demonstrates another way to expand one slide into many slides.
MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the
following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
Sub ExpandSlide()
' Enable the error handler.
'
On Error GoTo ErrorHandler
Dim oShape As Shape
Dim i As Long
Dim oSlide As Slide
Dim strTitle As String
Dim lStrLen As Long
Dim lParas As Long
Dim lCurrIndex As Long
Dim lLastSlide As Long
Dim ErrMsg As String
' Check to see if the presentation is in the correct view.
' Raise the custom error message 555.
'
If ActiveWindow.ViewType <> ppViewNormal And ActiveWindow.ViewType _
<> ppViewSlide Then
Err.Raise 555, "Expand Slide Macro", _
"Not in Slide View or Normal View"
End If
With ActiveWindow.Selection
' Set lCurrIndex to the current slide index.
' Set lLastslide to the current slide index.
'
lCurrIndex = .SlideRange.SlideIndex
lLastSlide = lCurrIndex
' Check each shape of the current slide; check to
' see if it is a Body placeholder.
'
For Each oShape In .SlideRange.Shapes
If oShape.PlaceholderFormat.Type = ppPlaceholderBody Then
' Set lParas to the number of paragraphs in the
' Body placeholder. Does not differentiate between
' first level bullets and lower level bullets.
'
lParas = oShape.TextFrame.TextRange.Paragraphs.Count
For i = 1 To lParas
' Set strTitle to the current paragraph index.
'
strTitle = oShape.TextFrame.TextRange.Paragraphs(i).Text
' Determine how long the string is. Then, as long as
' it is not the last parapgraph in the Body placeholder,
' strip off the last two characters, the line feed and
' carriage return.
'
lStrLen = Len(strTitle)
If lParas <> i Then
strTitle = Left(strTitle, lStrLen - 2)
End If
' Set lLastSlide to the next available index position.
' Create a news slide, with the Bulleted Text layout.
' Assign the text from the current paragraph to the
' title placeholder. Return to the original slide.
'
lLastSlide = lLastSlide + 1
Set oSlide = _
ActivePresentation.Slides.Add(lLastSlide, ppLayoutText)
oSlide.Shapes(1).TextFrame.TextRange.Text = strTitle
ActiveWindow.View.GotoSlide (lCurrIndex)
Next i
End If
Next
End With
Exit Sub
ErrorHandler:
' Create Error message and raise dialog with error message.
'
ErrMsg = "Error:" & Err.Source & vbNewLine & Err.Description
MsgBox ErrMsg, vbCritical, "Error Message"
End Sub
REFERENCES
For more information about using the sample code in this article, click
the article number below to view the article in the Microsoft Knowledge
Base:
Q212536
OFF2000: How to Run Sample Code from Knowledge Base Articles
Additional query words:
vba expand stretch split up divide samples ppt ppt2000 ppt2k ppt9 9.0 2k 2000 powerpnt
Keywords : kbdta kbdtacode OffVBA KbVBA
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto