I got tired of scooting around a document putting things in double-quotes long after I'd typed in the text.
I can think of several enhancements, amongst them an option to trim the selection of any leading or trailing spaces.
In the meantime, drop this code into your Normal.dot, select a word or phrase, and run a macro.
Code: Select all
Function EmbraceIn(strText As String)
''' Chris Greaves 28 Feb 2014
''' This function does NOT test for an appropriate selection (length, context etc.)
''' This function aims to place a single character before and after a selected portion of text.
''' I generally assign the macro EmbraceInSmartQuotes to the shortcut key Ctrl-Shift-"
Dim rng As Range
Set rng = Selection.Range
rng.InsertAfter (Right(strText, 1))
rng.InsertBefore (Left(strText, 1))
'Sub TESTEmbraceIn()
' Call EmbraceIn("""")
'End Sub
End Function
Sub EmbraceInStraightQuotes()
Call EmbraceIn("""")
End Sub
Sub EmbraceInSmartQuotes()
Call EmbraceIn(ChrW(8220) & ChrW(8221))
End Sub
Sub EmbraceInSquareBrackets()
Call EmbraceIn("[]")
End Sub
Sub EmbraceInSolidus()
Call EmbraceIn("|")
End Sub