Get the template name associated with a PowerPoint presentation

I'm using the PowerPoint 2013 UI in my example below but the same question applies to other versions.

If I create a new presentation from a given template and then click File and over on the right column, click the Properties drop down to then click Advanced, I can see the Template name in the Summary tab which appears to the the filename of the POTX file the presentation was created from (minus the extension).

I want to extract this name in VBA but when I use:


Open in new window

...I get different text which equates to the design name and not the template name as returned by this property:


Open in new window

e.g. both lines above return the same text but not the name of the POTX template!

How do I get the name of the original template as displayed in PowerPoint's Properties dialog box?
LVL 15
Jamie GarrochSenior Technical Consultant at BrightCarbonAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jamie GarrochSenior Technical Consultant at BrightCarbonAuthor Commented:
Found the solution in BuiltInDocumentProperties:

‘ Returns the POTX filename (minus extension) that the current presentation was built from
Public Function TemplateName() As String
  Dim oDocProp As DocumentProperty
  For Each oDocProp In ActivePresentation.BuiltInDocumentProperties
    If oDocProp.Name = "Template" Then TemplateName = oDocProp.Value: Exit Function
End Function

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft PowerPoint

From novice to tech pro — start learning today.