Macro in IDE

  • Thread starter Thread starter Francois Soucy
  • Start date Start date
F

Francois Soucy

Hi All,

I would like to know if it's possible to fire a event whenever I add
a new class file to my project? What I want is to automate the process of
adding some region and header comment to each new file that I add to my
project. It's possible? If yes can you give me a direction?

Give you an example:
In the Project Menu I add a class and name it Something.vb
The the "macro event" will add these thing automaticly:

'********************
'Francois
' 50/05/2005
'
'This class do some things
'*********************

Public Class Something

#region "Declaration"
#end region

#region "Methodes"
#end region

....and so on

end class





Thank
Francois

Sorry for my english
 
Francois,

Why would you do something generic in the design time of your program, when
you can do it at runtime instead. (I know one reason, however that is in my
opinion spending time with nothing).

I am curious what it can be

Cor
 
I don't know How I could do something like I want in runtime? It make no
sense for me. Ken Tucker show me a good solution.

Francois
 
Hi Francois,

In the Macros IDE, open the EnvironmentEvents and use the
DocumentEvents_DocumentOpened event. You must cast Document to TextDocument,
guess if the document is new or not and if it is new, then use something
like TextDocument.StartPoint.CreateEditPoint.Insert(myheader)

Another approach is to edit the template used by VS.NET, as described in my
KB article pointed by Ken.

Also, my add-in (below) allows you to do that with a single mouse click or
keystroke, and another feature allows you to verify that each file has a
compliant header.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top