On this page you will start up Visual Studio and become familiar with tools and windows required. So if you haven’t already done so, open Visual Studio now. Open your web site. Also open the Solution Explorer Window (Ctrl-Alt-L). Here is what the Solution Explorer Window looks like on my machine.
Yours will be similar to the above, except it will not have the PHDnet1 location. The location is not important.
Open Macro Explorer (Alt-F8).

Any macros that you see here can be run with a simply double-click of the mouse. If you expand the RecordingModule node you should see the macro named TemporaryMacro. To record, navigate through Tools >> Macro >> Record Temporary Macro. Once recorded, the “recording” will reside in this TemporaryMacro. This is just as simply as it sounds. Learn more about recording temporary macros by looking in Chapter 5 of the Microsoft book that came with your Visual Studio 2005 Professional Edition or visit this Microsoft Visual Studio Macros Page. What I am about to show you goes well beyond this.
Well I’m anxious to show you some of the power of Microsoft’s Visual Studio macros. Let’s create a few simple ones. Do a right-click on the very top item named Macros. Click “New Macro Project…” and enter whatever name you like. I’ll go with “PHD_Macros” which for me “PHD” stands for “Powerhouse Data”. Immediately you will see a Module1 beneath the newly created project as seen here:

Go ahead and rename that Module1 to “ModuleCreation” just for looks (right-click and rename).
We want to make macros that are dynamic and collaborate with us. We need them to act like DotNetNuke Modules; they should take our inputs and display outputs. Right-click ModuleCreation and choose “New macro”. The Macros IDE will open and you will be positioned inside a Macro1 subroutine.
Sub Macro1()
End Sub
Once again, let’s rename something! Change the above code Sub Macro1() to Sub ASCII_Values(). Insert the following the code into this subroutine:
Dim i As Integer
Dim MyOutput As OutputWindowPane
MyOutput = AddOutputPane("ASCII Values")
Print(MyOutput, " ")
Print(MyOutput, Now())
Print(MyOutput, " ")
For i = 1 To 255
Print(MyOutput, Str(i) & " - " & Chr(i))
Next
Having done the work mentioned so far, you have just created a macro with the name “ASCII_Values”. Do a “Ctrl-S” to save your work. This macro is not yet ready to be run. I need output functions. I like using the Output Window in the manner which I learned from Jeff Cogswell in his book, “Developing Visual Studio .Net Macros and Add-Ins”. The function needed is:
Function AddOutputPane(ByVal title As String) As OutputWindowPane
Dim outwin As Window = DTE.Windows.Item _
(EnvDTE.Constants.vsWindowKindOutput) outwin.Visible = True
Return outwin.Object.OutputWindowPanes.Add(title)
End Function
Along with this subroutine:
Sub Print(ByVal Output As OutputWindowPane, ByVal text As String)
Output.OutputString(text & Chr(13))
End Sub
Insert those two blocks of code above the line Sub ASCII_Values ().
Directly underneath Public Module ModuleCreation insert the line:
Dim MyOutput As OutputWindowPane
After doing a quick saving (Ctrl-S), you are now ready to run this first macro. Return to Visual Studio and view your Macro Explorer window.

This window should appear with an ASCII_Values macro similar to the one shown above. Double-click to run it. If everything is working then an “Output” window having the name “ASCII Values” will appear. The text contents start with the current date which is then followed by a list of character values 1 through 255.