Imports System
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module Module1
Sub FindUP()
Dim Sel As TextSelection = ActiveDocument.Selection
If (Not Sel.IsEmpty()) Then
DTE.Find.FindWhat = Sel.Text
End If
DTE.Find.MatchCase = False
DTE.Find.MatchInHiddenText = True
DTE.Find.MatchWholeWord = False
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
DTE.Find.SearchSubfolders = False
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.Backwards = True
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE.Find.Execute()
End Sub
Sub FindDown()
Dim Sel As TextSelection = ActiveDocument.Selection
If (Not Sel.IsEmpty()) Then
DTE.Find.FindWhat = Sel.Text
End If
DTE.Find.MatchCase = False
DTE.Find.MatchInHiddenText = True
DTE.Find.MatchWholeWord = False
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
DTE.Find.SearchSubfolders = False
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.Backwards = False
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE.Find.Execute()
End Sub
Sub SelectionLines()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
If (Sel.IsEmpty()) Then
Sel.SelectLine()
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.BottomPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
If (Sel.TopPoint.AtEndOfLine) And (Not Sel.TopPoint.AtStartOfLine) Then
Sel.MoveToLineAndOffset(Sel.TopPoint.Line + 1, 1, True)
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.TopPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
If (Sel.BottomPoint.AtEndOfLine) And (Not Sel.BottomPoint.AtStartOfLine) Then
Try
Sel.MoveToLineAndOffset(Sel.BottomPoint.Line + 1, 1, True)
Catch ex As Exception
txt = Sel.Text
Sel.Insert(txt + vbCrLf, 0)
End Try
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.BottomPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
Sel.MoveToLineAndOffset(Sel.TopPoint.Line, 1, True)
End Sub
Sub SelectUp()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.Delete()
Sel.LineUp()
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine - 1, 1)
Sel.MoveToLineAndOffset(backLine - 1, 1, True)
End Sub
Sub SelectDown()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.Delete()
Sel.LineDown()
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine + 1, 1)
Sel.MoveToLineAndOffset(backLine + 1, 1, True)
End Sub
Sub DuplicateUp()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.MoveToLineAndOffset(frontLine, 1)
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine, 1)
Sel.MoveToLineAndOffset(frontLine + backLine - frontLine, 1, True)
End Sub
Sub DuplicateDown()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.MoveToLineAndOffset(backLine, 1)
Sel.Insert(txt)
Sel.MoveToLineAndOffset(backLine, 1)
Sel.MoveToLineAndOffset(backLine + backLine - frontLine, 1, True)
End Sub
End Module
Imports EnvDTE
Imports EnvDTE80
Imports System.Diagnostics
Public Module Module1
Sub FindUP()
Dim Sel As TextSelection = ActiveDocument.Selection
If (Not Sel.IsEmpty()) Then
DTE.Find.FindWhat = Sel.Text
End If
DTE.Find.MatchCase = False
DTE.Find.MatchInHiddenText = True
DTE.Find.MatchWholeWord = False
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
DTE.Find.SearchSubfolders = False
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.Backwards = True
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE.Find.Execute()
End Sub
Sub FindDown()
Dim Sel As TextSelection = ActiveDocument.Selection
If (Not Sel.IsEmpty()) Then
DTE.Find.FindWhat = Sel.Text
End If
DTE.Find.MatchCase = False
DTE.Find.MatchInHiddenText = True
DTE.Find.MatchWholeWord = False
DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
DTE.Find.SearchSubfolders = False
DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
DTE.Find.Backwards = False
DTE.Find.Action = vsFindAction.vsFindActionFind
DTE.Find.Execute()
End Sub
Sub SelectionLines()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
If (Sel.IsEmpty()) Then
Sel.SelectLine()
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.BottomPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
If (Sel.TopPoint.AtEndOfLine) And (Not Sel.TopPoint.AtStartOfLine) Then
Sel.MoveToLineAndOffset(Sel.TopPoint.Line + 1, 1, True)
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.TopPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
If (Sel.BottomPoint.AtEndOfLine) And (Not Sel.BottomPoint.AtStartOfLine) Then
Try
Sel.MoveToLineAndOffset(Sel.BottomPoint.Line + 1, 1, True)
Catch ex As Exception
txt = Sel.Text
Sel.Insert(txt + vbCrLf, 0)
End Try
End If
If (Sel.ActivePoint.AbsoluteCharOffset = Sel.BottomPoint.AbsoluteCharOffset) Then
Sel.SwapAnchor()
End If
Sel.MoveToLineAndOffset(Sel.TopPoint.Line, 1, True)
End Sub
Sub SelectUp()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.Delete()
Sel.LineUp()
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine - 1, 1)
Sel.MoveToLineAndOffset(backLine - 1, 1, True)
End Sub
Sub SelectDown()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.Delete()
Sel.LineDown()
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine + 1, 1)
Sel.MoveToLineAndOffset(backLine + 1, 1, True)
End Sub
Sub DuplicateUp()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.MoveToLineAndOffset(frontLine, 1)
Sel.Insert(txt)
Sel.MoveToLineAndOffset(frontLine, 1)
Sel.MoveToLineAndOffset(frontLine + backLine - frontLine, 1, True)
End Sub
Sub DuplicateDown()
Dim Sel As TextSelection = ActiveDocument.Selection
Dim txt As String
Dim frontLine As Integer
Dim backLine As Integer
SelectionLines()
frontLine = Sel.TopPoint.Line
backLine = Sel.BottomPoint.Line
txt = Sel.Text
Sel.MoveToLineAndOffset(backLine, 1)
Sel.Insert(txt)
Sel.MoveToLineAndOffset(backLine, 1)
Sel.MoveToLineAndOffset(backLine + backLine - frontLine, 1, True)
End Sub
End Module