Dim selection As TextSelection = DTE.ActiveDocument.Selection'定义 TextSelection 对象 selection.StartOfLine()'移动到当前光标所在行的起始位置 Dim keyword = selection.Text.Trim()'取得整行文本 '获取当前选择首点所在行 Dim endLine As Integer endLine = selection.TopPoint.Line selection.NewLi…