I'm attempting to launch Microsoft PowerPoint, open a presentation, and then run a macro contained within the presentation. However, the following code isn't working properly. Any help is much appreciated.
Sub Main
Dim filename = "filename"
Dim macroname = "macroname"
Call OpenFile
End Sub
Function OpenFile(filename, macroname)
Dim pptApp As PowerPoint.Application
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
Dim pptPres As PowerPoint.Presentation
Set pptPres = pptApp.Presentations.Open(filename, msoCTrue)
pptApp.WindowState = ppWindowMaximized
'The following line generates the error.
pptApp.run(macroname)
End Function
Thank you in advance.
Sub Main
Dim filename = "filename"
Dim macroname = "macroname"
Call OpenFile
End Sub
Function OpenFile(filename, macroname)
Dim pptApp As PowerPoint.Application
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
Dim pptPres As PowerPoint.Presentation
Set pptPres = pptApp.Presentations.Open(filename, msoCTrue)
pptApp.WindowState = ppWindowMaximized
'The following line generates the error.
pptApp.run(macroname)
End Function
Thank you in advance.