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
Microsoft DevelopmentMicrosoft PowerPoint

Avatar of undefined
Last Comment
xenacode

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
John Wilson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
xenacode

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
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy