More Cool Macro Ideas
To keep your excitement about macros going, I want to give you some ideas for moving forward with them, and show you a few more code snippets to test in your VSMacros module. Because you created a Try...Catch block, you could create macros for
If...Then...Else blocks
For...Next loops
Variable declarations
While Loops
Adding an Imports or Using Statement
Almost all classes I write use the System.Data.SqlClient namespace, and maybe the System.IO namespace or System.XML namespace. To add text to the top of your file, you can use the StartOfDocument method, as in Listing 16.7.
Listing 16.7. Adding Imports/Using Statements to Class Files
Sub StartOfDocumentExample() Dim txt As TextSelection = DTE.ActiveDocument.Selection With ... |
Get Sams Teach Yourself Visual Studio® .NET 2003 in 21 Days now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.