Add number of place holders one after the other on powerpoint.

Hello,
How can i add pictures placeholders on a powerpoint slide to appear next to each other and take a new  row when the row is full.
Also when the slide is full how it can autogenerate a new slide with placeholder for the pictures.
Currently I have a code for this, but its not very efficient as I am declaring the place of the placeholder.

Private Sub AddSlides()
        Dim intCurrSlide As Integer = ppPrsn.Slides.Count
        Dim currSlide As PowerPoint.Slide = ppPrsn.Slides(intCurrSlide)
        Dim objShape As PowerPoint.Shape = Nothing
        Dim pptLayout As Microsoft.Office.Interop.PowerPoint.CustomLayout
        pptLayout = ppPrsn.Slides(1).CustomLayout
        Dim length = l + 7
        Dim top = t + 10
        For i = 0 To 47

            pptLayout.Shapes.AddPlaceholder(PowerPoint.PpPlaceholderType.ppPlaceholderPicture, length, top, 75, 101)
            length = length + 78
            If i = 11 Then
                length = 10
                top = top + 130
            ElseIf i = 23 Then
                length = 10
                top = top + 130
            ElseIf i = 35 Then
                length = 10
                top = top + 130

            End If

        Next
        If ppPrsn.Slides.Count = 2 Then
            Dim slide As PowerPoint.Slide
            slide = ppPrsn.Slides.AddSlide(ppPrsn.Slides.Count, pptLayout)
        End If

        FlgSlideCreated = True

    End Sub

Open in new window

RIASAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try something like this
Private Sub AddSlides()
        Dim intCurrSlide As Integer = ppPrsn.Slides.Count
        Dim currSlide As PowerPoint.Slide = ppPrsn.Slides(intCurrSlide)
        Dim objShape As PowerPoint.Shape = Nothing
        Dim pptLayout As Microsoft.Office.Interop.PowerPoint.CustomLayout
        pptLayout = ppPrsn.Slides(1).CustomLayout
        Dim length = l + 7
        Dim top = t + 10
        For i = 1 To 200 ' Nr of placeholders
            pptLayout.Shapes.AddPlaceholder (PowerPoint.PpPlaceholderType.ppPlaceholderPicture, Length, Top, 75, 101)
            Length = Length + 78
            If i Mod 12 = 0 Then
                Length = 10
                Top = Top + 130
            End If
            If i Mod 48 = 0 Then
                Top = t + 10
                ppPrsn.Slides.AddSlide(ActivePresentation.Slides.Count + 1, ppPrsn.Slides(1).CustomLayout)
                pptLayout = ppPrsn.Slides(ppPrsn.Slides.Count).CustomLayout
            End If
        Next
        FlgSlideCreated = True

    End Sub

Open in new window

Regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RIASAuthor Commented:
Thanks mate!!! will try and brb
0
RIASAuthor Commented:
Thanks again!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.