Return the name of the open PPT file - VBA

sanrv1f

MrExcel MVP
Joined
Jan 1, 2009
Messages
3,474
Office Version
  1. 2016
Platform
  1. Windows
I need macro that lists the of names of the ppt files that are currently open, I also need the macro to update the list when I open a new ppt file,
 
Last edited:

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I have got this from searching the board,

Code:
Sub InstanceCount()
Dim objList As Object, objType As Object, strObj$
strObj = "Powerpnt.exe"
Set objType = GetObject("winmgmts:").ExecQuery("select * from win32_process where name='" & strObj & "'")
If objType.Count > 1 Then
MsgBox objType.Count & " Excel instances are running on your system.", , "More than one instance"
Else
MsgBox "Only this instance is running on your system.", , "One and done"
End If
End Sub

this checks, if Powerpoint is open, and counts the instances,

how can I modify this to return the file name to a cell,
assuming that there would be only one PPT open at any point in time
 
Upvote 0
The PowerPoint application has a Presentations property that returns all open presentations. Write a routine that loops through that collection. PP also has an event, PresentationOpen. Write an event procedure for that event.
 
Upvote 0
See my article in the MSKB:
How to safely instantiate another Office application and close it only if you started it
http://support.microsoft.com/kb/555191

I have got this from searching the board,

Code:
Sub InstanceCount()
Dim objList As Object, objType As Object, strObj$
strObj = "Powerpnt.exe"
Set objType = GetObject("winmgmts:").ExecQuery("select * from win32_process where name='" & strObj & "'")
If objType.Count > 1 Then
MsgBox objType.Count & " Excel instances are running on your system.", , "More than one instance"
Else
MsgBox "Only this instance is running on your system.", , "One and done"
End If
End Sub

this checks, if Powerpoint is open, and counts the instances,

how can I modify this to return the file name to a cell,
assuming that there would be only one PPT open at any point in time
 
Upvote 0
Tushar,

Thanks for that advise and the links, that helped me to change my view at the problem, I will post back once I design solution
 
Upvote 0
ok, here is the first step,

Code:
Sub StartOtherApp()
    Dim ppApp As PowerPoint.Application, IStartedPP As Boolean
    On Error Resume Next
    Set ppApp = GetObject(, "powerpoint.application")
    On Error GoTo 0
    If ppApp Is Nothing Then
        IStartedPP = True
        Set ppApp = CreateObject("powerpoint.application")
        End If
    ppApp.Open "D:\Documents and Settings\sankaranarayanan ven\My Documents\san\my\test\Intake Report_AUO.ppt"
    
'    If IStartedPP Then
'        ppApp.Quit
'        End If
'    Set ppApp = Nothing
    End Sub

Im getting "user defiend type not-defined error on the very first line:confused:
am I missing any reference to a library ?
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top