Word 信头生成宏不能一致地应用格式
我使用的是 Microsoft Word 2010,我尝试为信头创建的每个宏都不起作用。当我运行宏时,我的文本格式没有显示!大小发生变化,但粗体不适用。奇怪的是,每次我在同一文档或不同文档中运行宏时,它都不会显示相同的内容。
我希望信头宏的结果如下(顶行应为 16,第二行应为 10,最后两行应为 12):
特纳父子会计有限公司
澳大利亚号码:22 333 111 555
22 Kings St,悉尼 2000
电话:(02) 9675 4444 传真:(02) 9675 4443
文本代码为:
Sub Letterhead()
'
' Letterhead Macro
'
'
Selection.TypeText Text:="Turner and Sons Accounting Pty Ltd"
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.Font.Size = 10
Selection.TypeText Text:="ABN: 22 333 111 555"
Selection.TypeParagraph
Selection.Font.Size = 12
Selection.TypeText Text:="22 Kings St, Sydney 2000"
Selection.TypeParagraph
Selection.TypeText Text:="Phone: (02) 9675 4444 Fax: (02) 9675 4443"
End Sub
I'm using Microsoft Word 2010, and every macro I try and create for a letterhead does not work. The formatting of my text is not shown when I run the macro! The size changes, but the bold does not apply. The weird thing is every time I run the macro in the same document or in a different document, it doesn't ever show the same.
I'd like a letterhead macro to turn out like this (The top line should be in 16, the second line in 10 and the last two lines in size 12):
Turner and Sons Accouting Pty Ltd
ABN: 22 333 111 555
22 Kings St, Sydney 2000
Phone: (02) 9675 4444 Fax: (02) 9675 4443
The code for the text is:
Sub Letterhead()
'
' Letterhead Macro
'
'
Selection.TypeText Text:="Turner and Sons Accounting Pty Ltd"
Selection.TypeParagraph
Selection.Font.Bold = wdToggle
Selection.Font.Size = 10
Selection.TypeText Text:="ABN: 22 333 111 555"
Selection.TypeParagraph
Selection.Font.Size = 12
Selection.TypeText Text:="22 Kings St, Sydney 2000"
Selection.TypeParagraph
Selection.TypeText Text:="Phone: (02) 9675 4444 Fax: (02) 9675 4443"
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是否只是“粗体”不一致,如果是这样,这是由于您的“Selection.Font.Bold = wdToggle”行所致,请将其更改为“Selection.Font.Bold = True”
然后您可以添加“Selection.Font” .Bold = False”到最后,这样你就可以使用标准字体继续..
Adam
Is it just the "bold" that is inconsistant, if so this is due to your "Selection.Font.Bold = wdToggle" line, change this instead to "Selection.Font.Bold = True"
You can then add "Selection.Font.Bold = False" to the end so you resume in standard font..
Adam