Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Opening ppt

Posted on 2006-11-02
4
Medium Priority
?
266 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

704 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