?
Solved

Launch powerpoint from VB 6.0

Posted on 2003-02-27
6
Medium Priority
?
290 Views
Last Modified: 2008-02-26
I want to know how to launch a powerpoint from VB and how to quit the point.
Let's say the path for my ppt file is E:\VB

Thank you
0
Comment
Question by:sluhur
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 8039759
Try add the M$ PowerPoint Object Library from Reference, then use code like this:

Private Sub Command1_Click()
    Dim presApp As New PowerPoint.Application
    Dim pres As PowerPoint.Presentation
    Dim myPPT As String
    'myPPT = OpenDialog(Me, "MS Power Point (*.ppt)" + Chr$(0) + "*.ppt")

    myPPT = "E:\VB\abc.ppt"

    If myPPT = "" Then
        Set pres = Nothing
        Set presApp = Nothing
    Else
        presApp.Visible = msoCTrue
        Set pres = presApp.Presentations.Open(FileName:=myPPT)
       
    End If
End Sub

Hope this helps
0
 
LVL 14

Expert Comment

by:aelatik
ID: 8039780
Set OpenPP = CreateObject("powerpoint.application")
OpenPP.Visible = True
0
 

Author Comment

by:sluhur
ID: 8041967
Thanks. It works great and you right on top of it.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sluhur
ID: 8042508
Here is another question.
I do a presApp.quit
Then I try to run again, still in the same running program, it didn't let me.

Do I need to add New Powerpoint.Application?
How can I do that?

What is the best way to quit the presentation?
0
 

Author Comment

by:sluhur
ID: 8042549
The error that I got is Run-time error -2147417848 (80010108)

Automation error
The object invoked has disconnected from its client

0
 

Author Comment

by:sluhur
ID: 8042723
I solve the problem.
instead of presApp.quit
I use presApp.ActivePresentation.Close

0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question