Little Professor for Android Copy Location Shell Extension Open with Notepad Shell Extension IrfanView region capture plugin Auto File Save Add-In Strip'em Add-In AutoCopy chrome extension C-style time_t conversion Macros Page Useful Links |
Visual Studio MacrosThis page describe a set of visual studio macros I wrote for my personal use. I find them very helpful, and hopefully you can use them too.
Mark Locations & Jump To Them More macros will be added in the future. Mark Locations & Jump To Them
This set of macros provide the ability to "remember" the cursor position in your source code,
and later jump to these locations. 'Globals Dim doc(9) 'Array with 10 elements to remember the document path Dim col(9) 'Array with 10 elements to remember the cursor x position Dim row(9) 'Array with 10 elements to remember the cursor y position Sub RememberPosition(ByVal pos) 'DESCRIPTION: Save the cursor position in the specified location doc(pos) = ActiveDocument.FullName col(pos) = ActiveDocument.Selection.CurrentColumn row(pos) = ActiveDocument.Selection.CurrentLine End Sub Sub GotoPosition(ByVal pos) 'DESCRIPTION: Return the cursor to the specified location Dim myDocument If col(pos) <> 0 and row(pos) <> 0 Then For Each myDocument in Application.Documents If myDocument.FullName = doc(pos) Then myDocument.Active = True ActiveDocument.Selection.MoveTo row(pos), col(pos) Exit Sub End If Next End If End Sub
The following two macros are used to remember position #0 and
to jump to position #0. They simply call RememberPosition and GotoPosition
with 0 as an argument. I define them because it is not possible to assign
a keyboard shortcut to macros that have arguments. Sub Remember0() 'DESCRIPTION: Remember position 0 RememberPosition(0) End Sub Sub Goto0() 'DESCRIPTION: Goto position 0 GotoPosition(0) End Sub In this manner, define the other Remember* and Goto* macros (up to 9) and assign similar keyboard shortcuts. To download the macros in a zip file right-click here and select Save... Header-Source Flip
This macro is similar to the HeaderFlip tool from Workspace Utilities,
and is based on a macro by Nooruddin Kapasi which I found in CodeGuru.
This macro checks the name of the file in the active window. If it is a .cpp file, it
will open its .h file (a file with similar name but with .h extension). If it is an .h
file, it will open the corresponding .cpp file. Sub HeaderFlip() 'DESCRIPTION: Switch between header and cpp Dim myDocument Dim activeDoc Dim switchToDoc Dim Flag Dim Flag1 Flag1 = 0 Flag = 1 activeDoc = ActiveDocument.FullName tmp = InStr(activeDoc, ".cpp") If tmp Then switchToDoc = Left(activeDoc, Len(activeDoc) - 3) + "h" Flag1 = 1 Else tmp = InStr(activeDoc, ".h") If tmp Then switchToDoc = Left(activeDoc, Len(activeDoc) - 1) + "cpp" Flag1 = 1 End If End If For Each myDocument In Application.Documents If myDocument.FullName = switchToDoc Then myDocument.Active = True Flag = 0 Exit For End If Next If Flag And Flag1 And switchToDoc<>"" Then Documents.Open switchToDoc, "Text" End If End Sub To download the macro in a zip file right-click here and select Save... |