Macro to Wrap Selected Text with Brackets

S

Stefan Blom

Try the following macro:

Sub AddBrackets()
Selection.InsertBefore "["
Selection.InsertAfter "]"
End Sub
 
R

RYA

Hi,

Is there a way to wrap pre-selected text with brackets using VBA? To
explain, the user types text (can be numbers, dates, one or more words),
selects the text to be wrapped with brackets and kicks off a macro to insert
open bracket at the beginning ([) and a closing bracket (]) at the end of
the selection.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top