Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Launch powerpoint from VB 6.0

Posted on 2003-02-27
6
Medium Priority
?
293 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
  • 4
6 Comments
 
LVL 55

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month11 days, 8 hours left to enroll

564 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