vba - 如何测试是否使用VBA安装了字体?

标签 vba fonts

检查是否使用VBA安装了特定字体的最简单方法是什么?

最佳答案

http://www.vbcity.com/forums/topic.asp?tid=57012
重定向到
http://vbcity.com/forums/t/55257.aspx

此vb6代码与VBA兼容:

Function FontIsInstalled(sFont As String) As Boolean
    '' This reference should already be set by default
    '' Tools > References > OLE Automation
    Dim NewFont As StdFont
    On Error Resume Next
    Set NewFont = New StdFont
    With NewFont
        ' Assign the proposed font name
        ' Will not be assigned if font doesn't exist
        .Name = sFont
        ' Return true if font assignment succeded
        FontIsInstalled = (StrComp(sFont, .Name, vbTextCompare) = 0)
        ' return actual font name through arguments
        sFont = .Name
    End With
End Function

关于vba - 如何测试是否使用VBA安装了字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1170468/

相关文章:

winapi - 字体如何告诉操作系统 "I AM a MONSPACED/FIXED-WIDTH FONT"?

css - 在 weebly 博客上使用自定义字体

arrays - Excel宏将整列转换为一维数组

vba - 更改 Word 中的样式

excel - VB : Filtering data on excel table

java - 根据屏幕尺寸变化更改字体

html - 使用 CSS 自定义字体 - 仅适用于 Internet Explorer

java - 为单个字符串设置字体?

excel - 为什么我无法在 VBA 中向选项按钮发送参数

使用 SendKeys 无法正常工作的 VBA 项目密码保护