I have this macro in an automatically created data file (part of the creation is inserting and running the macro). I want to open a template file and then need to run a PPT macro that takes in the excel data file name. The one that called the macro (data1.xlsm) I have this but can't figure out the macro call with the file name.
Dim PPTObj As Object
Set PPTObj = CreateObject("PowerPoint.application")
With PPTObj
.Presentations.Open Filename:="C:\Presentations\Company\Template.pptm"
.Run "Template.pptm!MainMacro"
End With
.Run "Template.xlsm!MainMacro(filename)" is what I am looking for.
Maybe the other direction is to get the object in PPT. But how do I get the data file name/path without knowing it beforehand?
Set wb - getobject(openwexcelfile)
Since another program (not office) is creating the data file, I do not know it's name or directory, but it is the file calling the powerpoint macro and it will be open.
Thanks for any insight.