ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening Powerpoint file from Excel (https://www.excelbanter.com/excel-programming/346754-opening-powerpoint-file-excel.html)

JakeyC

Opening Powerpoint file from Excel
 
Hi -

I have the following code to start a new instance of Powerpoint when
the value in Cell A1 is greater than 10:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)

If Range("A1").Value 10 Then
Application.ActivateMicrosoftApp (xlMicrosoftPowerPoint)
End If

End Sub


How can I adapt this code to specify which file to open in Powerpoint?
It will always be the same file so I can hard code the filename into my
macro, something like 'C:\My Folder\My Presentation.ppt

Thanks in advance

Jake


Bob Phillips[_6_]

Opening Powerpoint file from Excel
 
Jake,

Try this

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)
Dim oPPT as Object

If Range("A1").Value 10 Then
Set oPPT = GetObject("C:\My Folder\My Presentation.ppt")
oPPT.Parent.Parent.Visible = True
End If

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"JakeyC" wrote in message
ps.com...
Hi -

I have the following code to start a new instance of Powerpoint when
the value in Cell A1 is greater than 10:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)

If Range("A1").Value 10 Then
Application.ActivateMicrosoftApp (xlMicrosoftPowerPoint)
End If

End Sub


How can I adapt this code to specify which file to open in Powerpoint?
It will always be the same file so I can hard code the filename into my
macro, something like 'C:\My Folder\My Presentation.ppt

Thanks in advance

Jake




JakeyC

Opening Powerpoint file from Excel
 
Thanks for your help.
That certainly opens Powerpoint but not the actual show, just the
program. Any ideas why it may not work?


Bob Phillips[_6_]

Opening Powerpoint file from Excel
 
Do you mean launching into Powerpoint Viewer?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JakeyC" wrote in message
ups.com...
Thanks for your help.
That certainly opens Powerpoint but not the actual show, just the
program. Any ideas why it may not work?




JakeyC

Opening Powerpoint file from Excel
 
Yes, I'd like it to start the show. I realise my '.ppt' extension was
misleading - the one I used in the end was '.pps', however both seem to
launch an empty powerpoint.


Rowan Drummond[_3_]

Opening Powerpoint file from Excel
 
Hi Jake

If you set a reference to the Microsoft Powerpoint Object Library then
you could try it like this:

Private Sub Workbook_SheetChange(ByVal Sh As Object, _
ByVal Target As Excel.Range)

If Range("A1").Value 10 Then

Dim ppApp As PowerPoint.Presentation

Set ppApp = GetObject("C:\temp\pptShow.pps")
ppApp.SlideShowSettings.Run

End If
End Sub

Hope this helps
Rowan

JakeyC wrote:
Yes, I'd like it to start the show. I realise my '.ppt' extension was
misleading - the one I used in the end was '.pps', however both seem to
launch an empty powerpoint.


Bob Phillips[_6_]

Opening Powerpoint file from Excel
 
Just run the show then, add

oPPT.SlideShowSettings.Run

at the end.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"JakeyC" wrote in message
ups.com...
Yes, I'd like it to start the show. I realise my '.ppt' extension was
misleading - the one I used in the end was '.pps', however both seem to
launch an empty powerpoint.





All times are GMT +1. The time now is 06:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com