Solved

Opening ppt

Posted on 2006-11-02
4
254 Views
Last Modified: 2010-04-30
Hi,

Should be a fairly simple one this but my head's in the clouds today and you guys will do this a lot quicker than I could hope to...

I am running a piece of code in Excel to open and transfer to a ppt. First thing I need to do is check if there is a presentation open, if not then look for C:\MyFolder\MyPres.ppt

If this doesn't exist then to open
C:\MainFolder\Pres.ppt    which will always exist.

Kind regards
Darren
0
Comment
Question by:UINVDJM
[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
  • 2
  • 2
4 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
ID: 17858510
Hey Darren, long time,

Give this a shot:

Sub ForDarren()
 Dim HasPresentation As Boolean, PPTApp As Object
 On Error Resume Next
 Set PPTApp = GetObject(, "powerpoint.application")
 On Error GoTo 0
 If PPTApp Is Nothing Then
  Set PPTApp = CreateObject("powerpoint.application")
  PPTApp.Visible = True
  HasPresentation = False
 Else
  If PPTApp.ActivePresentation Is Nothing Then
   HasPresentation = False
  Else
   HasPresentation = True
  End If
 End If
 If Not HasPresentation Then
  If Len(Dir("C:\MyFolder\MyPres.ppt")) = 0 Then
   PPTApp.Presentations.Open "C:\MainFolder\Pres.ppt"
  Else
   PPTApp.Presentations.Open "C:\MyFolder\MyPres.ppt"
  End If
 End If
End Sub

Matt
0
 
LVL 11

Author Comment

by:UINVDJM
ID: 17858756
Long time indeed, figured is what about time I returned and hounded you guys some more! ;)

Your code works perfectly of course. Thank you kindly!
0
 
LVL 35

Expert Comment

by:mvidas
ID: 17858873
Glad to help! First time I've ever written anything powerpoint related :)
0
 
LVL 11

Author Comment

by:UINVDJM
ID: 17858893
I've just picked it up recently and now trying to tidy up a lot of reports that I had written in Excel. It seems fairly intuitive.

I may have a more complex question in the next couple of days so keep your eyes open! :)
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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 Month5 days, 2 hours left to enroll

635 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