SOLVED

Use style to add quotation marks

Copper Contributor

Hi, I use a character style to highlight some special expressions in my document. Now I want to have quotation marks around these expressions. One convenient way to do it would be to ask the style to add the quotation marks. Is that possible?

2 Replies
best response confirmed by mparento (Copper Contributor)
Solution

@mparento While you cannot include the quotation marks as part of the style, using a macro such as the following, you could have the style specified in the macro applied to the selected text and have quotation marks inserted before and after it

Set rng = Selection.Range
With rng
    .Style = "Strong"
    .InsertBefore Chr(34)
    .InsertAfter Chr(34)
End With

Thanks Doug for the good idea! I was hoping to do it with the style itself. That way, if I change my mind, I could modify the style and update the whole document. With the macro, I assume that I would have to run it on each occurrence to add/remove the quotation marks. That being said, I may find you suggestion very helpful in other situations.

 

Addendum: thinking about it a bit more, I may use your suggestion in the present case. It would make it easier to add the quotation marks. Thanks again!

1 best response

Accepted Solutions
best response confirmed by mparento (Copper Contributor)
Solution

@mparento While you cannot include the quotation marks as part of the style, using a macro such as the following, you could have the style specified in the macro applied to the selected text and have quotation marks inserted before and after it

Set rng = Selection.Range
With rng
    .Style = "Strong"
    .InsertBefore Chr(34)
    .InsertAfter Chr(34)
End With

View solution in original post