How to detect theme fonts in Powerpoint 2007 VBA?

Does anyone know how to detect the use of Theme fonts in Powerpoint 2007 slide objects using VBA? If you look at it Shape.TextFrame.TextRange.Font.Name, the font name will appear as a simple name (for example: "Arial"), whether the font has been assigned as a fixed name or a theme name (can be changed with the document theme). I do not see another object in the object model that would designate the name as attached to the topic (for example, ObjectThemeColorfor flowers).

Thanks!

+3
source share
1 answer

There is no direct method (which I know), however you can check with If / Then:

Sub checkthemeFont()
    Dim s As Shape
    Set s = ActivePresentation.Slides(1).Shapes(1)
    Dim f As Font
    Set f = s.TextFrame.TextRange.Font

    Dim themeFonts As themeFonts
    Dim majorFont As ThemeFont

    Set themeFonts = ActivePresentation.SlideMaster.Theme.ThemeFontScheme.MajorFont
    Set majorFont = themeFonts(msoThemeLatin)

    If f.Name = majorFont Then
        Debug.Print f.Name
    End If
End Sub
+1
source

Source: https://habr.com/ru/post/1720019/


All Articles