ReDim


ReDim searches your Visual Basic files for all of the declared variable names used in the program.   It then rebuilds them in a neat and orderly way.   The result is that your program is much neater and easier to read.

These are the keywords that are searched for and re-aligned:
Const
Dim
Global
Private
Private Const
Private Declare
Private Function
Private Property
Private Sub
Private Type
Public
Public Const
Public Declare
Public Function
Public Property
Public Sub
Public Type
Static
Type

Note:   Options are available in the Popup Menu that allow you to run ReDim by itself, run Comments by itself, or to run Both at the same time.

Note:   Make sure the program you want to ReDim is not currently open.   The reason for that is that if you run ReDim, then close and save your program, all of the changes made by ReDim will be wiped out.

Step 1)   Start ReDim.

Step 2)   Select the correct Drive/Folder, then Double-Click the VBP that you want ReDim'ed.

Step 3)   Close ReDim and open the VBP that you just cleaned up.   Browse through it to see the neat looking code.   It's always a good idea to run the program just to make sure everything still works.   I have not had a single instance where something did not work after ReDim'ing, but anything is possible...

If there are any problems, all original files were saved.   The name was changed as follows:
XYZ.Frm would be changed to
XYZ_Frm_2007-05-31_01-23-45.Bak

That's the File Name with the "." (period) changed to an "_" (underscore), then the Current Date 2007-05-31 followed by another "_" (underscore) then the Current Time 01-23-45, and finally the ".Bak" .

To restore a file, delete the file now named XYZ.Frm.
Then change the new file name to XYZ.Frm and you're back in business.

Comments


I wrote Comments as a VB programing tool back in September of 2001.   Whenever I am cleaning up a program, I always run ReDim and then I run Comments immediately afterwards, so in October of 2008, I finally merged the two programs.

I noticed that many programs (including my own) were difficult, or at least annoying, to debug because I had to search around for the comments.   Even if a programmer is neat, as values and variable names, etc are changed, any commenting alignment is also changed.

This program takes care of all that by scanning your forms and reorganizing the comments in a neat orderly fashion.   Before I go any farther, let me state that Comments does not write comments or spell check or anything of the kind.   It also does not alter any lines of code (except, of course, lines that have comments in them).

So what does it do?   It scans your code to find out which lines have comments and to find out how long the code lines are.   Then it reorganizes the comment lines by adding or removing leading spaces.   The result is a program that is neater and easier to debug.

Note:   The Spacing Control only affects lines that have Comments at the back of the line.
Please see B4_After.Rtf for an example of what a program might look like before and after running Comments.

You can control the Comments spacing by changing the value in the Spacing box which is located at the top of the Drive box.   I have it set to 15 which means the comments will be spaced at character position 15, 30, 45, etc.   After you run Comments, if you don't like the spacing, or alignment, change the number in the Spacing box and run it again.   I have used 25 for some files, and up to 60 for others.   It all depends on the coding of your files and what you like.   The good news is that you can run Comments as often as you like until it looks good to you.

The original file is saved in the original directory with the current Date and Time and a 'Bak' extension so that you may easily restore it if necessary.


  •  
  • DownLoad   your free copy of   ReDim.Exe                         DownLoad   the ReDim Visual Basic source files.