Visual Basic Code of the Week (COTW)
Issue #98
Online Version at (paid subscribers only)
All content and source code is Copyright (c) 1999 by C&D Programming Corp. No part of this issue can be reprinted or distributed in any manner without express written permission of C&D Programming Corp. Word, Excel and Visual Basic are trademarks of Microsoft Corp.

Get paid to surf the web!

If you would like to get paid for surfing the web, jump to


In this Issue

In this issue we show how to retrieve the version number of any file which contains a version resource (which are mostly DLL, OCX and EXE files).

Questions? Email us at


This issue allows you to easily get the version number of a file. This is especially useful to ensure the DLL's installed on a users system matches what your software requires.

If you have any questions about using this class, let us know at


Public Function GetVersionNumber(ByVal sFileName As String) As String

This single routine returns a text string which shows the version number of the full filename specified by sFilename. If the version can not be determined it returns an empty string.


See above description.

Sample Usage

This sample will show the version number of the file called MSVBVM50.DLL.

    MsgBox GetVersionNumber("C:\WINDOWS\SYSTEM\Msvbvm50.dll")

Source Code

To see the source code for this issue you must be a subscriber to Code of the Week. If you are a subscriber the source code is available at the following address:

This document is available on the web

Paid subscribers can view this issue in HTML format. There is no additional source or information in the HTML formatted document. It just looks a little better since we have included some HTML formatting. Just point your browser to link at the top of this document.

Other links

Contact Information

C&D Programming Corp.
PO Box 20128
Floral Park, NY 11002-0128
Phone or Fax: (212) 504-7945