TPE

http://bayanbox.ir/view/263405954590585756/2mobile.png

Tavvafi@gmail.com


≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

Sub RunPPT-InvokeMacro()
' Execute Powerpoint and invoke the macro EXAMPLE
' EXAMPLE must be available to PPT, in an auto-loaded add-in, for example

' Start PowerPoint
Dim oPPTApp As PowerPoint.Application

On Error Resume Next
Set oPPTApp = New PowerPoint.Application
oPPTApp.Visible = True

' Were we able to start PPT?
If Err.Number <> 0 Then
oPPTApp.Quit
Set oPPTApp = Nothing
Exit Sub
End If

' Insert other error/sanity checks here to ensure that there really is an instance
' of PPT loaded

' Having established that PPT is loaded you could also test for the presence of the expected add-in
Dim lTemp as Long
Dim bAddinLoaded as Boolean
For lTemp = 1 to oPPTApp.Addins.Count
if oPPTApp.Addins(lTemp) = "YourAddin" then
bAddinLoaded = True
end if
Next lTemp

if not bAddinLoaded Then
oPPTApp.Quit
Set oPPTApp = Nothing
Exit Sub
End if

oPPTApp.Run "EXAMPLE"

' And quit PPT
oPPTApp.Quit

End Sub