Link to home
Start Free TrialLog in
Avatar of xenacode
xenacodeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

PowerPoint Start-up Events

I am developing an add-in for PowerPoint 2007 & 2010 using VSTO 4. My add-in needs to take different actions when  PowerPoint starts depending on how PowerPoint was started. If the user has started PowerPoint with the default/blank template (e.g. from a PowerPoint icon in the Windows Start menu) I need to do one thing but if the user opens PowerPoint with a different template e.g. by opening a POTX file from Windows Explorer I need to do something else.

Is there a reliable way to detect how the user opened PowerPoint? Any hints/clues welcome.

Thanks,

Pete Luetchford
Xenacode Ltd
ASKER CERTIFIED SOLUTION
Avatar of John Wilson
John Wilson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenacode

ASKER

Yes, that's it. That does the job. Thank you

So, I create  aProperty called DefaultTemplateName in the ThisAddIn class then in the the Add-in Startup event:

Dim dummyPres = Me.Application.Presentations.Add(Microsoft.Office.Core.MsoTriState.msoFalse)

DefaultTemplateName = dummyPres.TemplateName

dummyPres.Close()

Then in the PowerPoint Application NewPresentation event:

Private Sub PowerPointApplication_NewPresentation(ByVal Pres As Microsoft.Office.Interop.PowerPoint.Presentation) Handles app.NewPresentation

If (Pres.TemplateName = Globals.ThisAddIn.DefaultTemplateName) AndAlso (_PowerPointApplication.Presentations.Count = 1) Then

etc etc