Solved

Opening ppt

Posted on 2006-11-02
4
229 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now