andrew4582

DuplicateLine VSMACRO

Jul 2nd, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'set keyboard settings under 'options' to ctl-d
  2.    Sub DuplicateLine()
  3.         Dim sel As TextSelection = DTE.ActiveDocument.Selection
  4.         sel.StartOfLine(0) '' move to start
  5.        sel.EndOfLine(True) '' select to end
  6.        Dim line As String = sel.Text
  7.         sel.EndOfLine(False) '' move to end
  8.        sel.Insert(ControlChars.NewLine + line, vsInsertFlags.vsInsertFlagsCollapseToEnd)
  9.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment