Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel 之间的差异:.Font.FontStyle=";黑体字;vs.Font.Bold=msoTrue_Excel_Vba - Fatal编程技术网

Excel 之间的差异:.Font.FontStyle=";黑体字;vs.Font.Bold=msoTrue

Excel 之间的差异:.Font.FontStyle=";黑体字;vs.Font.Bold=msoTrue,excel,vba,Excel,Vba,我正在通过excel vba构建图表。我使用下面的一行将我的X轴字体设置为粗体: Activechart.Axes(xlCategory).TickLabels.Font.FontStyle = "Bold" Activechart.Axes(xlCategory).TickLabels.Font.Bold = msoTrue 这两种方法都有效,但我想知道有什么区别 谢谢您可以使用FontStyle一次设置多个字体属性 ActiveChart.Axes(xlCate

我正在通过excel vba构建图表。我使用下面的一行将我的X轴字体设置为粗体:

       Activechart.Axes(xlCategory).TickLabels.Font.FontStyle = "Bold"
       Activechart.Axes(xlCategory).TickLabels.Font.Bold = msoTrue
这两种方法都有效,但我想知道有什么区别


谢谢

您可以使用FontStyle一次设置多个字体属性

ActiveChart.Axes(xlCategory).TickLabels.Font.FontStyle=“Bold Italic”

Font.FontStyle=“Bold”与.Font.Bold不一样……它不起作用,因为它从excel的区域设置中获取了单词“Bold”,在我的例子中,它使用了单词“Εντονα”,这是希腊语中的粗体。 现在,如果您想进行比较,例如:

如果选择了.Font.fontstyle=“Bold”,则…

在具有希腊区域设置的excel中,您将获得错误的结果


可以安全地使用.Font.Bold=True以避免上述情况。

谢谢,我也注意到了这一点,但我想知道是否还有其他区别。该属性似乎没有太多功能。我认为Excel只是在模仿Web API的字体对象。这似乎是使用的一个非常有效的理由。Font.Bold=True。谢谢
With ActiveChart.Axes(xlCategory).TickLabels.Font

    .Font.Bold = True
    .Font.Italic = True

End With