Contents of the PROJPRN.WRI file
Written by Sarah Holland
October 25, 1992
Project Printer allows you to get a nicely formatted listing of your Visual Basic file in Word for Windows, while also saving text/loading text for you. It is written for Visual Basic programmers.
Why you want this program:
1.It save/loads Visual Basic code - see VBTips (under .EXE Size / Junk In EXE's) for a complete description of why this is good. In brief, it gets rid of all the junk from previous versions of your program that would otherwise increase the size of your EXE file, and possibly cause other problems.
2.It formats your code nicely in Word for Windows - if you've ever wanted hard copy of your program, you know that getting a nice printout is a problem. Project Printer formats your code nicely in WinWord, complete with outlining features, and you can print from there to your heart's content.
3. The code shows you how to do neat things, such as find out from design time Visual Basic what path your project is in, and what files are in the project. It does that by using SendKeys, GetActiveWindow, GetWindowText, and list box messages such as LB_GETTEXT and LB_GETCOUNT.
While you have a project loaded in Visual Basic (design time) run PROJPRN.EXE. If you want the output formatted in Word, it will take care of loading Word for you. Make sure that VBLIST.DOT is in the WinWord directory. You can modify VBLIST.DOT so that the program listings are formatted the way you want them - the code itself is in the Normal style, file headings are in the Heading 1 style, and Sub and Function headings are in the Heading 2 style. VBLIST.DOT is currently in a landscaped layout, with two columns (with line down the middle) with a footer containing page number and date information.
Important: After you start Project Printer, your cursor is put down at the bottom left of the screen when the program starts to do its work. Don't do anything in Windows while the program is working, because selecting things and pressing buttons may cause Windows to crash and burn!
Save/Load code files - check this box if you want your code saved as text, then loaded as text.
Format in WinWord - check this box if you want a listing of your code in Word for WIndows.
Save VB Files - check this box if you want your programs automatically saved after they have been saved as text and then loaded as text. You wouldn't check this box if you wanted to see if your code is safe after this program has been run.
Restart Visual Basic - check this box if you want Visual Basic to close and then restart after you have Saved/Loaded your code. Your program files will automatically be saved. Visual Basic will not be restarted if you haven't saved your files at least once before. You would choose this option to get the minimum possible EXE file size.
VBLIST.DOTWord for Windows template file. Must be placed in WinWord directory.
Project Printer is actually two separate programs, one in Visual Basic and one in Word Basic (VBLIST.DOT: FormatList). Project Printer reads the Visual Basic Project Window list box to determine the number of files and the file names, reads the path information from the Save Project As dialog box, saves the text out (and then reads it back in again if desired, and then saves the file if desired), and then copies all the text files to one text file, which it places in the root directory of C drive. It then commands Word for Windows with DDE to FileNew with VBLIST.DOT and then run the FormatList macro. The FormatList macro reads in the text file and formats the separate file, sub, and function headings as outline headings, and then sorts the subroutines alphabetically per program file.
The code in the subroutine ReadVB demonstrates how to steal information from other programs, when the program does not supply any good way for you to get some information through DDE. For example, there is no way that I know for another program to get the path and file information for the current Visual Basic program through DDE. However, this information is displayed in a label on the Save Project As dialog box, and in a list box on the Project Window. A program can read that information by using API calls to get the handle of the control, and then checking the control caption or contents.
Problems & Warnings
I think that it should error trap OK if WinWord is not present, but I haven't been able to test that.
I think that I've gotten all the bugs out of this program, as I have not encountered any problems with it lately. However, watch out if modify it, because it can get stuck in some Do Loops if you're not careful. I am not responsible for any damages you may suffer by use of this program. Take steps to protect very important programs before using it! The reason you have an option to Save VB Files is so you can double-check first and see if everything is all right before saving the file, or not if you prefer. If you're not sure of the program, don't check Restart Visual Basic.
Heck no - don't worry about sending money. If you really want to though, I wouldn't turn it away:
3 - 2176 West 13th Avenue
Vancouver, B.C. V6K 2S1
Or, you can drop me a note if you like it, have suggestions, want more information on it, or (especially!) if you find problems with it!
I'd like to thank the Visual Basic forum on CompuServe for being a constant source of ideas and support, and also my husband Brad for his unerring ability to find bugs and crash my programs.
e headings are in the Heading 1 style, and Sub and Function headings are in the Heading 2 style. VBLIST.DOT is currentlywsokgc>_I[W#SOKh$$0wsokgc_[hWuSY