View Single Post
 
Old 11-16-2017, 02:57 AM
slaycock slaycock is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Sep 2013
Posts: 255
slaycock is on a distinguished road
Default

Just a note of caution. It's generally better to replace text descriptions of style names by the corresponding wdStyleBuiltIn constant as these work irrespective of the language version whereas the text version of style names change depending if you have an English or non-english version of word.


HOWEVER, Microsoft in their normal cack-handed way have updated the default styles provided in the Normal template but have not extended the wdStyleBuiltin enumeration to match. Thus you can replace 'Comment text' with wdStyleCommentText but you cannot replace and 'Balloon Text' with the (predicted) constant wdStyleBalloonText.

Code:
Sub Document_Open()
With ActiveDocument
  With .Styles(wdStyleCommentText).Font
    .Name = "Arial"
    .Size = 12
  End With
  With .Styles(wdStyleBallonText).Font  <- Error 'The requested memeber of the collection does not exist'
    .Name = "Arial"
    .Size = 12
  End With
End With
End Sub
Therefore, if using a non-english version of word you need to use the correct language name for 'Balloon Text' etc.
Reply With Quote