Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can VBA Macros produce VB code in the code editor?

Status
Not open for further replies.

vbLew

Programmer
Feb 28, 2005
22
US
Hello All:

Just wanted to let you all know that I am a very lazy programmer. And a little new to VBA....
I'm used to creating macros in C to save me from typing alot of code, and I was wondering if VBA Macros work the same way.

For example, can I set up a macro to output 'Dim userInput as string' to the code editor, (where 'userInput' is a varible name that I give). Thus, all I have to do is run the String macro everytime I was to declare a String.
This would save me from typing
"Dim blahblah as string" evertime I want to declare a string.

Any thoughts??? Thanks a bunch!!!!

 
Make a reference to the "Microsoft Visual Basic for Applications Extensibility 5.3" library to code the IDE. I use macros all the time for repetitive chores, like adding the current date/time to function and module headers. Books about developing Addins for VB show how to do it. I have one called "Developing Visual Basic Add-ins" by Steven Roman (O'Reilly Press) that shows how to do it all.

There are also some good addins that have features like instant error handlers and customizable headers, etc. I've been using one that's pretty handy, found here:

MZ-Tools

I use the "Close All Windows" and "Clear Immediate Window" features so often I don't know how I got along without it before...[worm]

VBSlammer
redinvader3walking.gif

"You just have to know which screws to turn." - Professor Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top