Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

userform click, open ppt, run show, close ppt

81 views
Skip to first unread message

jim oswell

unread,
Apr 8, 2002, 2:55:26 PM4/8/02
to
If There is anyone out there that can solve this I would
appreciate the help. I am trying to run a PPT slide show
from an excel template. Click control, open PPT, run
show, close PPT, return to userform. I am stuck on closing
PPT. Nothing I seem to try works.

Private Sub Label50_Click()
Dim oPPT As PowerPoint.Application
Dim oPres As PowerPoint.Presentation
Set oPPT = CreateObject("Powerpoint.Application")
Dim path22 As String
path22 = Worksheets("HOME").Range("W4").Text
oPPT.Visible = msoTrue
'Path to File DRP_22
Set oPres = oPPT.Presentations.Open(path22)
With oPres.SlideShowSettings
.ShowType = ppShowTypeSpeaker
.RangeType = ppShowSlideRange
.StartingSlide = 1
.EndingSlide = 2
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
End With

With oPPT
PowerPoint("DRP_22").Save
PowerPoint("DRP_22").Quit
End With

End Sub

Steve Rindsberg

unread,
Apr 8, 2002, 4:35:03 PM4/8/02
to
See Shyam's reply further down the list, Jim.

The code you posted is basically telling PPT to start the slide show, then
*immediately* asking it to save and quit.
I've never tried exactly this, but it's sure to do one of three things:

1) Exactly what you asked for. Start the show, then quit. So fast that the
show won't even appear on screen.

2) Start the show, then ignore you when you ask it to quit since it's busy
showing a show <WC_Fields>go 'way boy, you bother me</WC_Fields>

3) Go poof

Shyam's code doesn't allow later lines to execute until the slide show ends.

Jim Oswell

unread,
Apr 8, 2002, 5:05:58 PM4/8/02
to
Steve
I tried to use his code to no avail code may have been
tested out of sequence should I start with Shyam's code?

>.
>

Jim Oswell

unread,
Apr 8, 2002, 5:06:04 PM4/8/02
to
Steve
I tried to use his code to no avail code may have been
tested out of sequence should I start with Shyam's code?

>.
>

Steve Rindsberg

unread,
Apr 8, 2002, 10:24:27 PM4/8/02
to
> I tried to use his code to no avail code may have been
> tested out of sequence should I start with Shyam's code?

Given a choice, I'd *always* start with Shyam's code rather than my own.
<g>

Shyam Pillai

unread,
Apr 8, 2002, 9:51:02 PM4/8/02
to
Jim,
'----- Begining of Code -----
Private Sub CommandButton2_Click()
Dim oPPTApp As PowerPoint.Application
Dim oPPTPres As PowerPoint.Presentation
Dim PresPath As String
PresPath = Worksheets("HOME").Range("W4").Text
Set oPPTApp = CreateObject("PowerPoint.Application")
With oPPTApp
Set oPPTPres = .Presentations.Open(PresPath, , , False)
With oPPTPres
With .SlideShowSettings

.ShowType = ppShowTypeSpeaker
.RangeType = ppShowSlideRange
.StartingSlide = 1
.EndingSlide = 2
.AdvanceMode = ppSlideShowUseSlideTimings
.Run
.Saved = True
End With
Do While oPPTApp.SlideShowWindows.Count > 0
DoEvents
Loop
End With
End With
Set oPPTPres = Nothing
DoEvents
oPPTApp.Quit
DoEvents
Set oPPTApp = Nothing
MsgBox "Show ended and PowerPoint session was terminated.", vbInformation
End Sub
' ----- End of Code -----

--
Regards
Shyam Pillai

Handout Wizard
http://www.mvps.org/skp/how/

"jim oswell" <jos...@heery.com> wrote in message
news:655601c1df2e$f2275c40$a5e62ecf@tkmsftngxa07...

Michael Koerner

unread,
Apr 9, 2002, 7:53:49 AM4/9/02
to
ain't that the truth

"Steve Rindsberg" <stop...@its.source> wrote in message news:OlELex23BHA.2104@tkmsftngp02...

Jim Oswell

unread,
Apr 9, 2002, 12:21:38 PM4/9/02
to
Shyam & Steve
Thank You Very Much

I had small problem with Line .saved = true

.application.activepresentation.saved = msotrue
seemed to solve problem

Thanks Again

Jim Oswell

>.
>

Shyam Pillai

unread,
Apr 9, 2002, 1:19:57 PM4/9/02
to
Jim,
Change the code sequence from:

> > .Run
> > .Saved = True
> > End With

To:

> > .Run
> > End With
> > .Saved = True

--
Regards
Shyam Pillai

Shyam's ToolBox for PowerPoint
http://www.mvps.org/skp/toolbox

"Jim Oswell" <jos...@heery.com> wrote in message
news:03f901c1dfe2$9fe14c70$a4e62ecf@tkmsftngxa06...

> > Do While oPPTApp.SlideShowWindows.Count > 0

0 new messages