Results 1 to 4 of 4

Thread: power point error adding shapes

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    power point error adding shapes

    I get the following error when trying to add a shape -

    The index into the specified collection is out of bounds

    My Code--

    Set ppObj = New PowerPoint.Application
    Set ppPres = ppObj.Presentations.Open("P:\Default\Slide Master.ppt")
    'Set ppPres = ppObj.Presentations.Add
    i = 1
    ' Setup the set of slides and populate them with data from the
    ' set of records.
    With ppPres
        While Not rsSlide.EOF
            With .Slides.Add(rsSlide.AbsolutePosition, ppLayoutTitle)
                .Shapes(1).TextFrame.TextRange.Text = rsSlide("Title")
                i = i + 1
                While Not rsContent.EOF
                    .Shapes(i).TextFrame.TextRange.Text = rsContent("Text").Value
                    .Shapes(i).TextFrame.TextRange.Characters.Font.Color.RGB = RGB(255, 0, 255)
                    rsContent.MoveNext
                    i = i + 1
                Wend
                rsContent.MoveFirst
            End With
            rsSlide.MoveNext
        Wend
    -The error appears to happen when ever i try to add a shape object of 3 or higher, would anyone one be able to point out where i am going wrong
    Last edited by Aussiebear; 04-28-2023 at 08:08 PM. Reason: Adjusted the code tags

Posting Permissions

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