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.开发者_如何学Go 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
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
精彩评论