Solved

Opening ppt

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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…
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…

744 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

12 Experts available now in Live!

Get 1:1 Help Now