clhare
05-28-2008, 08:23 AM
I have a macro that adds styles to a document if they are not already there. Is there a way to also add a keyboard shortcut to the added styles using a macro?
Here's an example of the code I used to add a style:
' Create "NewStyle" Style
ActiveDocument.Styles.Add Name:="NewStyle", Type:= _
wdStyleTypeParagraph
With ActiveDocument.Styles("NewStyle")
.AutomaticallyUpdate = False
.BaseStyle = "OldStyle"
.NextParagraphStyle = "NewStyle"
End With
With ActiveDocument.Styles("NewStyle").ParagraphFormat
.SpaceBefore = 2
.SpaceAfter = 5.5
End With
Here's an example of the code I used to add a style:
' Create "NewStyle" Style
ActiveDocument.Styles.Add Name:="NewStyle", Type:= _
wdStyleTypeParagraph
With ActiveDocument.Styles("NewStyle")
.AutomaticallyUpdate = False
.BaseStyle = "OldStyle"
.NextParagraphStyle = "NewStyle"
End With
With ActiveDocument.Styles("NewStyle").ParagraphFormat
.SpaceBefore = 2
.SpaceAfter = 5.5
End With