views:

160

answers:

1

Hello,

I am working with the vs 2008 editor. Is there a way to take a piece of text for example, highlight it and use shortcuts to quickly add markup. For example, lets say I have the text, I went to the store and I want to bold the line the store, I have to type <b>the store</b>. Is there a quicker and easier way to do this?

Thanks, XaiSoft

+1  A: 

With HTML Editor just prese Ctrl+B...

With regular text editor VS does not provide something build-in, but you can add custom macros. Something like the following will do job for you.

Sub MakeSelectionBold()
        DTE.ActiveDocument.Selection.Text = "<b>" + DTE.ActiveDocument.Selection.Text + "</b>"
End Sub

You can then assign it to the short-cart or add button to our toolbar.

Mike Chaliy
Can you create macros with c# sytnax?
Xaisoft
The problem is that VS supports only VB macroses. Or I missed something. This is built-in functional, you can find Macro Explorer window, or Tools/Macros/...
Mike Chaliy