views:

196

answers:

1

Found this:

Sub SurroundWithAppendTag()
        DTE.ActiveDocument.Selection.Text = ".Append(""" + DTE.ActiveDocument.Selection.Text + """)"
End Sub

But I can't seem to figure out how to loop through each line of text in the selection. Any thoughts?

+1  A: 

Simple:

Dim lines = DTE.ActiveDocument.Selection.Text.Replace(vbCrLf, vbLf).Split(vbLf)

The rest is up to you...

Paulo Santos
You're missing all of the .Append magic
JaredPar
@JaredPar does he want a full code? hehe :-P And what about some hard sweat?!
Paulo Santos
Got it, I believe. I'm assuming every line is pushed into lines, so I simply need to iterate and return?
jlrolin
@Paulo, sweating is bad when coding, it makes typing difficult :)
JaredPar