bstephens
08-03-2010, 10:01 PM
Hi, suppose I had the following text:
Except as disclosed in Schedule 1.1 Permitted Exceptions
and I want a macro that will be a one button press to turn it into this:
Except as disclosed in Schedule 1.1 ("Permitted Exceptions")
Where the words "Permitted Exceptions" are actually a style I created called "Defined Term" (instead of just regular underlining).
I created this macro as a start:
Sub CreateDefinedTerm()
Selection.Style = ActiveDocument.Styles("Defined Term")
Selection.InsertBefore "("""
Selection.InsertAfter """)"
End Sub
However, my macro doesn't give the result I expected because it inserts "straight quotes" instead of "smart quotes". Also, it is not smart about the selection because if I double click on a word it also selects the trailing space.
Does anyone know a way to revise the macro above so that it will:
1. Insert smart quotes instead of straight quotes, and,
2. Be smart about applying the "Defined Term" style, by applying it only to the word and not the parenthesis or quotes (regardless of whether it was double clicked on so that the trailing space is also selected or if the user goes through the trouble to exactly select it)
Thanks for your input ;)
Best,
Brian
Except as disclosed in Schedule 1.1 Permitted Exceptions
and I want a macro that will be a one button press to turn it into this:
Except as disclosed in Schedule 1.1 ("Permitted Exceptions")
Where the words "Permitted Exceptions" are actually a style I created called "Defined Term" (instead of just regular underlining).
I created this macro as a start:
Sub CreateDefinedTerm()
Selection.Style = ActiveDocument.Styles("Defined Term")
Selection.InsertBefore "("""
Selection.InsertAfter """)"
End Sub
However, my macro doesn't give the result I expected because it inserts "straight quotes" instead of "smart quotes". Also, it is not smart about the selection because if I double click on a word it also selects the trailing space.
Does anyone know a way to revise the macro above so that it will:
1. Insert smart quotes instead of straight quotes, and,
2. Be smart about applying the "Defined Term" style, by applying it only to the word and not the parenthesis or quotes (regardless of whether it was double clicked on so that the trailing space is also selected or if the user goes through the trouble to exactly select it)
Thanks for your input ;)
Best,
Brian