T
Toby Erkson
I have Excel 2002 running and want to RUN a macro contained in PowerPoint
2002 (OS is XP). My VBA is limited and the examples I've found aren't
helpful. Here is something I tried, trouble is, PowerPoint has to be
already launched and I don't want to do that if possible. Suggestions?
TIA!
-----
Private Sub Workbook_Open()
' Executing a PowerPoint macro...the indirect way.
Dim PPT As Object
Set PPT = CreateObject("PowerPoint.Application") 'Creates the object
pptDir = "C:\Projects\Automate\" '*
pptFileName = "Daily Orders Dashboard-test.ppt" '*
pptPath = pptDir & pptFileName
PPT.Presentations.Open pptPath, , , False 'Loads the already existing
(specific) object
TheMacroToExecute = "Main" '*
pptMacroPath = pptFileName & "!Module1." & TheMacroToExecute
PPT.Run pptMacroPath 'This snazzy command executes the macro
'Macro is done so quit PPT
PPT.Quit 'Exit the object
Set PPT = Nothing 'Destroy the object (free up memory)
Application.Quit 'Exit Excel
End Sub
-----
2002 (OS is XP). My VBA is limited and the examples I've found aren't
helpful. Here is something I tried, trouble is, PowerPoint has to be
already launched and I don't want to do that if possible. Suggestions?
TIA!
-----
Private Sub Workbook_Open()
' Executing a PowerPoint macro...the indirect way.
Dim PPT As Object
Set PPT = CreateObject("PowerPoint.Application") 'Creates the object
pptDir = "C:\Projects\Automate\" '*
pptFileName = "Daily Orders Dashboard-test.ppt" '*
pptPath = pptDir & pptFileName
PPT.Presentations.Open pptPath, , , False 'Loads the already existing
(specific) object
TheMacroToExecute = "Main" '*
pptMacroPath = pptFileName & "!Module1." & TheMacroToExecute
PPT.Run pptMacroPath 'This snazzy command executes the macro
'Macro is done so quit PPT
PPT.Quit 'Exit the object
Set PPT = Nothing 'Destroy the object (free up memory)
Application.Quit 'Exit Excel
End Sub
-----