vb.net powerpoint automation - last shape index?

Mutsop
Mutsop used Ask the Experts™
on
Hi,

So I have an existing powerpoint file with several slides. Now I want to input an adress into an existing textbox. For some reason I can't seem to do this... To be honest I haven't found any example/explanation on how to.

The only thing I found was to create a new shape and select a shape using its index to add a textframe. For example:
pptSlide = pptPres.Slides(1)
                pptSlide.Shapes.AddTextbox(1, 50, 100, 700, 100)
                pptSlide.Shapes(1).TextFrame.TextRange.Text = "I Love vb.net"

Open in new window


Problem is all these examples have apparently only one shape on their slide. So what I would like to acheive is select the last created shape.

How can I do this?
pptSlide = pptPres.Slides(1)
                pptSlide.Shapes.AddTextbox(1, 50, 100, 700, 100)
                pptSlide.Shapes(LAST_CREATED_SHAPE_INDEX).TextFrame.TextRange.Text = "I Love vb.net"

Open in new window


Regards
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2012
Top Expert 2014
Commented:
Try


pptSlide.Shapes(pptSlide.Shapes.Count).TextFrame.TextRange.Text = "I Love vb.net"

Author

Commented:
Offcourse!
I first thought that these shapes were stored in some kind of list. So I was trying to search for some "Last" method.

Thanks alot!
Most Valuable Expert 2012
Top Expert 2014

Commented:
Glad to help :-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial