如何在Powerpoint 2007 VBA中检测主题字体? [英] How to detect Theme fonts in Powerpoint 2007 VBA?

查看:91
本文介绍了如何在Powerpoint 2007 VBA中检测主题字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道如何使用VBA在Powerpoint 2007幻灯片对象中检测主题字体的使用吗?如果查看Shape.TextFrame.TextRange.Font.Name,则字体名称显示为简单名称(例如:"Arial"),而不管字体是被指定为固定名称还是主题名称(随文档主题而改变).我没有在对象模型中看到任何其他属性来将名称标记为与主题相关(例如ObjectThemeColor表示颜色).

Does anyone know how to detect the use of Theme fonts in Powerpoint 2007 slide objects using VBA? If one looks at Shape.TextFrame.TextRange.Font.Name the font name appears as simple name (ex: "Arial") whether or not the font was assigned as a fixed name or a Theme name (subject to change with the document theme). I don't see any other property in the Object Model that would flag the name as tied to a theme (such as ObjectThemeColor for colors).

谢谢!

推荐答案

(我不知道)没有直接方法,但是您可以使用If/Then进行检查:

There is no direct method (that I know of), however you can check with an 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

这篇关于如何在Powerpoint 2007 VBA中检测主题字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆