Open Powerpoint Slide from a WinForm

G

Guest

I have a VB.Net application and a PowerPoint presentation explaining how each
form in the application works, etc.. I would like to select and display the
slide appropriate for each form by pressing the F1 key. In other words, I
want to use the powerpoint presentation for my help system. I am calling the
SlideShow from the applications menu, and it works great; however, the same
techniques are not working for selecting individual slides.

How do I initialize the PowerPoint application and call an individual slide
from it from each Windows Form? The documentation for PowerPoint is not
adequate for my needs. Products: VB.Net 2..3 (1.1) and Powerpoint 2000
(v.9) Thanks. --
Will
 
W

W.G. Ryan eMVP

First you'll need to add a COM reference to the powerpoint library (unless
you already have the Presentation done and you want to Process.Start it)
Add this
Imports Microsoft.Office.Interop.PowerPoint

Dim present As New Application

present.Activate()

present.SlideShowWindows(Index:=1).View.Next()

The object model is pretty straightforward - if you're going to create new
slides you'll have to do that programatically - just record a macro if you
don't know the object model and that'll give you a good feel for what you
need to do.

HTH,

Bill
 
G

Guest

Bill,

Thanks. The code below did not work. SlideShowWindows seems to think that it
is an array and wants to have an initial value set. However...

you did nudge me in what I assume is the right direction. Here is what I got
to work -- al least in displaying a particular slide.

Private Sub FindSlide(ByVal n as Int16)

Const sLocation = <my location>

Process.Start(sLocation)
Dim present As New PowerPoint.Application
Dim oPres as PowerPoint.Presentation
' I don't know why, but I had to dimension a variable (oPres) as
PowerPoint.Presentation inorder to get the next line to work....

present.Presentations.Item(1).Slides.FindBySlideID(n).Select()

End Sub

Now, the fun part is that Slide # 1 = SlideID 256 (not 0 or 1), Slide #2 =
SlideID 257, Slide #3 = SlideID 265, Slide #4 = 258, etc. In short, they are
not in consecutive order at all. This is going to make it interesting and a
lot of fun assigning the SlideID values for over 200 forms and slides.

I would appreciate any explanation(s) you can give for any of the above.

Thanks,

You have helped.

Will
 

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