0

Would it be possible to have a control button (or any mechanism) that once clicked on, a textbox would appear with fields like macro name Sub "NewMacroTitle"(), a field for the date, a field for reference sources ("Getting Links/URL from a webpage-Excel VBA"found this here"), a brief description of what the macro is to do. All of these fields, except Sub "NewMacroTitle"(), would start with a ' to show a comment and all of this would be inserted into the VBA editor, or enter it into cells on a spreadsheet that could then be copied and pasted into the VBA editor.

My problem is this. I'm new to VBA. I'm also the world's worst at documenting macros. I get an idea for a macro, I'm off into the VBA editor writing away, maybe even get the macro complete. A week later I'm reviewing the macro and the first thing is "what the heck does this thing do?"

I hope you see what I'm trying to do, essentially some way to force me to document the macro before even starting the actual code.

Community
  • 1
  • 1
awsmitty
  • 121
  • 1
  • 2
  • 10
  • 2
    Your problem is a common one for any developer i think, and the only way to change that is to face it, and force yourself to document your work. i usually write a short explanation at the start of every macro if any other programmer would look to see, then at each point which i think the code might be not self explenatory i add comments as to what i did there. i ask myself, "if i look at this 1 week from now, would i be 100% what i did?" and if the answer is no, i comment on it. it's habits - and you should adopt them sooner instead of a workaround. – Avishay Cohen May 28 '15 at 12:50

1 Answers1

0

There are tools that will add pre-defined text to the header and/or footer of a sub. I use the one from MZ Tools for error handling code and adding my name and date to the header of each proc. It is worth a look.

ChipsLetten
  • 2,923
  • 1
  • 11
  • 28