PowerPoint Automation from VB.net

C

careta

Hello,
I'm trying to automate PP creation from VB.net. The initial code is
(as extracted from MSDN's KB209960):

Public Sub Command1_Click()
' Start PowerPoint.
Dim ppApp As PowerPoint.Application
ppApp = CreateObject("Powerpoint.Application")

' Make it visible.
ppApp.Visible = True

' Add a new presentation.
Dim ppPres As PowerPoint.Presentation
ppPres = ppApp.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoTrue)

' Add a new slide.
Dim ppSlide1 As PowerPoint.Slide
ppSlide1 = ppPres.Slides.Add(1,
PowerPoint.PpSlideLayout.ppLayoutText)

' Add some text.
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "My first slide"
....

The problem I have is that last line generates the following
compilation error:
"C:\temp\GeneratePP.vb(43): Interface 'PowerPoint.Shapes' cannot be
indexed because it has no default property.

Any hint?
Thanks,
careta
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top