winzip icon

A VB6 Source Code Browser

Submitted on: 3/9/2019 5:44:58 PM
By: Dave Carter 
Level: Advanced
User Rating: By 13 Users
Compatibility: VB 6.0
Views: 20623
     (Update Mar 2019) A Program to READ VB6 Source Code from a VB6 Project. Select a VBP to start. It is a stand-alone executable not an Add-In. I use it as a companion tool to developing large VB6 projects because it is informative in a way that the VB6 IDE isn't (without writing an Add-In).

The idea behind the main screen is that it has 3 view modes that are selected via the option buttons, bottom left from left to right:
1. Source Code View for reading source code.
2. Code Member Use is for finding where a code member is used.
3. Code Member List is for listing all code members in a project.

There several functions:
Source Code Review reports unused variables, parameters and private methods (e.g. functions, subs and properties).
Zip Viewer reads zipped VB6 Projects (perhaps from Planet Source Code) and can unzip them (Unzip32.dll required). It can also perform Search, Scan and source code review on the zipped project. Only unzips VBPs (not a general unzip facility).
Copy Project will copy just the development files and any others you specify to a new folder (helpful for de-cluttering a polished project). If you have Zip32.dll it can also zip the newly copied project. Also, checks for a '.manifest' and copies this as well if found.
Copy Code Member (e.g. Subs, Functions, Properties, Types, Enums, Constants, API Declares...) can drill down into its target code to discover any and all other code members that are used then sort and list them referentially for quick copying into a new project.
Line Use reports at Code Member, Module and Project levels show a breakdown of the code lines into those that are empty, commented, declarative and those that start with a control statement.

There is more but too much to mention here, please use the Help File, press F1; the Help File describes most of the forms, why they are there and how to use them.

Sorry, but Unicode and ASM strings do not work; lost in conversion from plain text to Rich Text (affects text in quotes and comments).
Code Members need to be formally declared for things to function as best they can (e.g. use Option Explicit and Dim variables).
As mentioned, Unzip32.dll and Zip32.dll are required to get the full functionality available, the Help File has some possible links to get them but they need to be properly installed from Win8 onwards.
Release version developed on Win7 which may or may not affect the Project's References, check the VBP for their paths and correct them as needed.

Acknoweldgements to Rde for Unzip to Memory, thanks Rohan :)

This was not an easy project but it was incredibly interesting and a lot of fun; Essentially, it's an experiment for me to study Code Parsing so there's a research bent to it all. There are some quirks but please remember this was hand written and tested by one bod on his own to suit his own needs at the time.

Update, 25 April 2018: included HTML and PDF versions of the Help file for those who do not have Winhelp.exe already installed in answer to issue raised by Greyling007 @ PSC (see comments below) with thanks. Best to use HTML version which first needs unzipping, load the file VBCBExp.HTML.

Update 9 March 2019: drag'n'drop VBP onto Project Explorer to load project, Manage Most Recently Used list, update to Copy Project, now can create logical source code folder for files e.g. Forms copied to folder 'frm', Classes to folder 'cls' etc. Plus few minor enhancements and fixes.
Please report any difficulties with the program's functions, thank you.

winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 4 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

4/24/2018 3:00:43 PMGreyling007

ThE help menu nor the F1 is working right.
I was not able to view the help file at all.
Project looks great though.
Good job!
(If this comment was disrespectful, please report it.)

4/25/2018 11:53:45 AMDave Carter

@ Greyling007
Thanks for raising this Help File issue and the kind words.
Please check out the new update (25 April 2018) for the HTML and PDF versions of the Help File as promised.
If possible find and install Winhelp.exe so that you can get Context Sensitive Help, this is what .CHM files need to load, at some point Microsoft stopped distributing it with their Operating Systems. It may be made available via installing the HTMLHelp program that comes on the Visual Studio 6 CD.

(If this comment was disrespectful, please report it.)

4/26/2018 12:34:29 AMGreyling007

Yes, the help now works.(I had to unblock it in propertys seperately- using Win7)
WOW!, you really did a good job with this. The help is clear and easy to understand and the program, I am sure, will be very useful. Very good job Sir!

(If this comment was disrespectful, please report it.)

4/26/2018 9:47:27 AMDave Carter

@ Greyling007
Good to hear, thanks for letting me know :)
(If this comment was disrespectful, please report it.)

4/26/2018 3:26:38 PMRde

Hi Dave
This has developed into a very useful tool
I like the ability to copy code with all related code
Very clear and understandable, first class code
I have voted you 5 big stars for,
Happy coding :)

(If this comment was disrespectful, please report it.)

4/27/2018 1:16:01 PMdave Carter

Hi Rohan
Thank you,
very much appreciate your review and vote.
Happy coding too :)
(If this comment was disrespectful, please report it.)

5/30/2018 4:02:16 AMRob C

Tried loading the project. Got many errors, and many frm log files. This may be the common error
Line 323: Class MSComctlLib.TreeView of control tvMbr was not a loaded control class.
Line 441: Class MSComctlLib.Slider of control SliderZoom was not a loaded control class.

I am using XP Pro 32bit
VB6 Pro SP5

(If this comment was disrespectful, please report it.)

5/30/2018 1:10:24 PMdave Carter

@ Rob C

Thanks for letting me know, I've replicated this on my XP and found a fix.

The problem is the difference between the version numbers attributed to MSCOMCTL.OCX in the VBP files of the project on Win XP and Win7.

The fix is to change the version from 2.1 to 2.0 ( #2.1#0; to #2.0#0; ) on the line that ends with MSCOMCTL.OCX in the VBP file ( VBPCB.VBP ) ( should be line 6 ).
the line starts as an Object reference e.g. Object={831FDD16-xxxx....}

Do this on a fresh download, discard the one that complained when loading.

Please let me know if this resolves your issue, it appears that Win7 is happy to load v2.0 so I can just update the project accordingly and re-upload.


(If this comment was disrespectful, please report it.)

5/30/2018 2:37:44 PMRob C

Thanks Dave,
I downloaded your zip again.
I had to do the edit that you described (very clearly, thanks).
And it ran without a whimper.

Thanks for prompt response,
(If this comment was disrespectful, please report it.)

5/30/2018 5:12:34 PMdave Carter

Good to hear Rob :)
Likewise, thanks for swift response, much appreciated.
I'll update the Project with the fix and re-upload in the near future.
(If this comment was disrespectful, please report it.)

5/31/2018 4:56:06 AMRob C

Just gave it a 5
What did you use to create the Help file ?

(If this comment was disrespectful, please report it.)

5/31/2018 10:10:11 AMdave Carter

Hi Rob

My Help Program is HelpNDoc by IBE-Software,
It's dead easy to use.

I have an old v3, it cost about 30 quid years ago for the standard licence but they have a free version which includes their banner on pages produced.

One needs HTML Help installed (see VS6 install disc 1) to get the Context Sensitive CHM file written, and CHM files need Winhelp.exe installed to be viewed (your XP should be fine with this).

Thanks for your vote :)


(If this comment was disrespectful, please report it.)

6/16/2018 6:34:49 PMfancytom

If there are 300 Sub and Function in one .VBP

BUT 2 SUB AND 1 function never be called .

How do i know the 2 Sub name? 1 function name?
(If this comment was disrespectful, please report it.)

6/19/2018 4:23:29 PMdave Carter


With a project loaded, select the first node of the project tree, right-click it and select 'Source Code Review' from the popup menu, if you just want to test a single source code file then select it and do the same thing.

Source Code Review is also available via the Tools menu and from the popup menu that comes from clicking the button captioned 'Rv' ( review functions ).

There is a bit more info in the Help file, if you have context sensitive help available, press F1 when the Source Code Review form is open, it's caption is "Experimental, find unused members'.


(If this comment was disrespectful, please report it.)

6/20/2018 11:37:47 AMfancytom

thanks: Good JOB !

1. you should add ONE BUTTON [PRINT] to print frmDepTester.tvMain treeView

2. when I click treeView Sub item. Always crach collapse
--I think : frmDepTester.rtb.FONT IS mistake .
I change FONT to [MS Sans Serif] . But NOT WORK.
This is error Picture :
(If this comment was disrespectful, please report it.)

6/20/2018 1:57:55 PMdave Carter

Thanks for bug report and picture along with the print suggestion.

Can you go to frmRevSrcCode \ tvMain.Node_Click and comment the following lines:
rtb.SelStart = iFind
rtb.SelLength = Len(sData(2))

(You'll find them towards the end of the procedure.)

Does this resolve the Invalid Property Value error you are getting? Let me know, thanks.

(If this comment was disrespectful, please report it.)

6/22/2018 9:41:23 AMfancytom

When I CLICK on :

Public Function Load_MDB_To_LISTVIEW(LvTable As ListView, X_MDB As String, X_資料表 As String, X_SQL As String, _
Optional X_Clear As String = "C", _
Optional X_ColumnHeader As String = "", _
Optional X_SmallIcon As Integer = 0, _
Optional X_KeyCol As String = "", _
Optional X_TagCol As String = "1", _
Optional X_PassWord As String = "") As Double

"X_資料表" is Traditional Chinese
So you can not find

iFind = rtb.Find(sData(2), , , rtfWholeWord)
iFind = -1

This is error Picture :

(If this comment was disrespectful, please report it.)

6/22/2018 12:01:46 PMdave Carter


Many thanks for your work debugging, very helpful :)

I'll update the project accordingly.

In the meantime you can either:
Add an Error Handler at the top of the procedure and / or
Comment out the two lines following the RichText Box Find command.

(If this comment was disrespectful, please report it.)

3/23/2019 1:21:01 AMTrent Jackson

I think you are quite professional. Are you planning on migrating to .NET soon? This way you can make modern and commercially viable applications to profit from. Making money is still the name of the game is it not? You want to be comfortable right? Eat well? Drive a nice car? Wash it on Sunday right after going to Church.
(If this comment was disrespectful, please report it.)

3/26/2019 12:02:32 AM

Thank You Dave
(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.