FMS Home FMS Software Development Team Blog FMS Facebook Page FMS Twitter
Jump: Search:

Total Visual SourceBook

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office 2007 and VB6

Supports Access/Office 2013, 2010 and 2007, and Visual Basic 6.0!

Separate version for Access/Office 2003, 2002, and 2000.

Separate version for:
Access 97/95


View all FMS products for Microsoft AccessAll Our Microsoft Access Products

SourceBook Info:

Why SourceBook?

 

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

 

 

 

 
Microsoft Access, Office/VBA, VB6 Modules royalty-free source code libraryMicrosoft Access Modules royalty-free source code libraryMicrosoft Access VBA and VB6 Module Library Free trial of Total Visual SourceBook for Microsoft Access, Office, VB6 and VBA

Microsoft Access, Office/VBA, and VB6 Modules and Classes in Total Visual SourceBook

Total Visual SourceBook includes 227 modules/classes with 125,000+ lines of royalty-free source code you can use immediately in your Microsoft Access, Excel, Office, VBA, and Visual Basic 6 (VB6) projects. Here's a complete list of every module and class included in Total Visual SourceBook along with a brief description of each. Click on the module name for its list of procedures.

Access: Automation

Launch and control Microsoft Access through Automation using VBA and VB6.

AccessAutomation (class) Working with the Microsoft Access Object Model through Automation using VBA and VB6. Most of the functionality available in Microsoft Access can be called from an external program, such as one written in Visual Basic 6 or Excel. This class contains methods and properties that show you how to get to database objects in a Microsoft Access database.
 

Access: Environment

Microsoft Access application, ADP, and startup routines, managing the Access window, mouse pointer, printers, ribbons, status bar, and Microsoft Visual SourceSafe

AccessInformation Get information on the currently running Access version and database's format type, version, file name, path, etc. using Access VBA.
AccessWindow Show and disable the Microsoft Access window controls to prevent users from exiting beyond your application's control using Windows API calls for 32 and 64 bit VBA.
ADP Routines for running Access Data Projects (ADPs) using VBA. Microsoft Access 2013 no longer supports ADPs. This code only runs in Access 2000, 2002, 2003, 2007 and 2010.
Application Microsoft Access application level routines for managing the database window, login information, and closing Access using VBA.
Mouse Change the mouse icon in Microsoft Access using VBA. Choose options beyond the DoCmd.Hourglass command.
PrinterAccess Manage the default printer, page orientation, and margins of Microsoft Access reports and forms in Access VBA.
Ribbons Manage the Access Ribbons to show, hide, minimize, maximize, and toggle it with Access VBA.
Startup Startup routines for a Microsoft Access database application to open backend databases, relink tables, set error trapping, etc. using Access VBA. For more information, read our whitepaper on Microsoft Access Split Database Architecture and Significantly Improve the Performance of Microsoft Access Databases with Linked Tables.
StatusBar Manage the Access status bar and progress meter using Access VBA.
VisualSourceSafe Working Microsoft Visual SourceSafe from Microsoft Access using Access VBA.
 

Access: Forms

Access Forms working with data in ACCDB, MDB, and ADPs, subforms, and spell checking

AccessSpellChecker Launching the Microsoft Access spell checker on an Access form and its subforms using VBA.
Forms General routines for Microsoft Access forms (Jet and ADP). Includes VBA support for 32 and 64 bit API calls.
Forms_ADP Routines for Microsoft Access forms in Access Data Projects (ADPs) using VBA. Microsoft Access 2013 no longer supports ADPs. This code only runs in Access 2000, 2002, 2003, 2007 and 2010.
Forms_Jet Routines for Microsoft Access forms using Jet (for MDB/ACCDB, not ADP) using VBA.
SubForms General routines for Microsoft Access subforms (Jet and ADP) in Access VBA. These functions will also work with normal forms, however, we are showing how to do additional things like: - Subclassing a subform in order to discern when an event on a subform fires. The example code here is all that is necessary for this since we do not need to create an additional class to accomplish this task. - Prevent adding records to a subform if it has met a maximum number of records with the AllowDisallowAdditionsToForm and GetRecordCount functions.
 

Access: Macros and Modules

Access Macros and modules

Macros Retrieving Microsoft Access macro names and running them in Access VBA.
Modules Compiling, opening, retrieving, replacing, saving, and deleting Microsoft Access modules using Access VBA.
 

Access: Objects

Access Objects

CurrentProject Get, set, and create Microsoft Access properties for the CurrentProject (Jet or ADP database) in VBA. This differs from the Jet/DAO databases properties.
DataOperations Perform data operations through DAO in VBA and VB6. Although queries should be considered the primary mechanism for working with data in Access, there are many places where complex needs eliminate queries as an option.
ManagingObjects Delete, duplicate, rename, and export Microsoft Access objects in Jet (ACCDB/MDB) and ADP databases in Access VBA.
MSysObjectsInfo Retrieve Access object information from the MSysObjects table using VBA and VB6.
Objects Manage open Access objects, inventory, active objects, hide and unhide, and minimizing, restoring and closing them in Access VBA. Supports the current Jet database or Access Data Project (ADP).
 

Access: Reports

Access Reports

Reports Manage Microsoft Access reports to design, preview, print, report view, output to PDF, and other formats with Access VBA.
 

Access Databases: Database

Microsoft Access Jet databases (ACCDB and MDB database formats) and their objects using ADO and DAO, plus workgroup and password security using VBA and VB6.

ADOConnJet (class) Class to support client/server operations using ADO in VBA and VB6. This class supports client/server operations using Microsoft's ActiveX Data Objects (ADO) technology. When using Visual Basic to deploy data-oriented local or client/server applications, you have a variety of development choices. You can use DAO and Jet, DAO and ODBC Direct, RDO and the Remote Data Control, or program directly against the ODBC API. This class exposes functionality to use ADO against Microsoft Jet data sources using the native Jet OLE DB driver. For information on the other choices, see the other classes in the Database category.
ADOConnJetODBC (class) Class to support client/server operations using the ADO feature in VBA and VB6. This class sets up an ADO connection object for use with a Microsoft Jet database. It uses the Jet ODBC driver rather than the Jet OLE DB driver.
JetDatabase (class) Using DAO with Microsoft Access Jet database objects for VBA and VB6. Microsoft Jet contains a versatile Database object that represents an open database. The term "database" is a broad term that can represent any one of the following: - A Jet or Access Database (.mdb, .mda, .accdb, .accda). - A Jet workgroup information file (.mda, .mdw). - An ODBC database, represented by a DSN. - A file system directory, such as a directory of xBASE or Paradox files. This class works with DAO/Jet objects at the database level. The class itself maps on top of a Jet/Access database and provides methods and properties for working with the objects contained in that database.
JetDatabase Creating and setting primary Access database characteristics in VBA and VB6.
JetDatabaseSecure32 Modifying Access database settings under workgroup security using JRO and 32 bit versions of VBA and VB6. This allows Microsoft Access to compact a database using different workgroup security than the one used to open Access. Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the 32 bit library MSJRO.DLL. JRO has been deprecated after MDAC 2.7. JRO is not available on the 64-bit Windows operating system, and is not supported in the Microsoft Access 2007-2013 file format (*.accdb).
JetEngine (class) Manage Access database characteristics such as passwords, encryption, compact, workspaces and tuning through DAO for VBA and VB6. The Microsoft Jet Database engine is exposed through the Data Access Objects (DAO) interface as the DBEngine object. Through this object, you can set various engine-wide parameters, and work with Jet workspace and database objects. This class puts a layer of high-level functionality on the Jet Engine. You can use the properties and methods in the class to perform engine-level operations, such as database maintenance, setting performance tuning options, retrieving low-level statistics, and setting workgroup options for secured databases.
JetEngine Manage Access database characteristics such as passwords, encryption, compact, workspaces and tuning through DAO in VBA and VB6. The Microsoft Jet Database engine is exposed through the Data Access Objects (DAO) interface as the DBEngine object.
JetObjectInfo Detailed information on individual Jet/Access objects using the Data Access Objects (DAO) object model in VBA and VB6.
JetSecurity Manage Jet security users and groups in a specified database in VBA and VB6. Each of the procedures in this module require that you pass a workgroup name to identify the workgroup you want to work with. By default, Visual Basic doesn't open a workgroup information file (*.MDA, *.MDW) unless you specify the SystemDB property of the DAO DBEngine object. When you specify a value for this property, the default DAO Workspace object, also known as Workspaces(0) is mapped to the workgroup information file you specify. In such a case, specifying a blank value for the strWorkgroup parameter of the procedures in this module effectively uses whatever workgroup information file you are currently using.
 

Access Databases: Fields

Microsoft Access ACCDB database field types such as Attachment, Hyperlink, and Multivalue fields using DAO to view, retrieve, edit and delete data using VBA and VB6.

AttachmentFields Working with Attachment fields in Access ACCDB databases using DAO with VBA or VB6.
HyperlinkFields Working with hyperlink fields in Access ACCDB databases using DAO with VBA or VB6.
MultiValueFields Working with MultiValue fields in Access ACCDB databases using DAO with VBA and VB6.
 

Access Databases: Snippets

Examples of using ADO and DAO to work with Microsoft Access databases, tables, and queries using VBA and VB6.

SnippetADOJetADOX Example working with Jet/Access data using the ActiveX Data Objects Security and DLL extensions (ADOX) object model using VBA and VB6.
SnippetADOJetData Example of working with Jet/Access data using the ActiveX Data Objects (ADO) object model using VBA and VB6.
SnippetDAOParity_Data Comparison of common data access activities against Jet table data using the DAO and ADO methods in VBA and VB6. While most Access and VB6 projects that use Jet use the DAO object model, ADO is also possible. This module shows common DAO tasks and then shows the equivalent ADO code.
SnippetDAOParity_DDLEngine Comparison of common data access activities against Jet object structures using the DAO and ADO methods in VBA and VB6. While most Access and VB6 projects that use Jet use the DAO object model, ADO is also possible. This module shows common DAO tasks and then shows the equivalent ADO code.
SnippetDAOParity_Security Comparison of common data access activities against Jet security using the DAO and ADO methods in VBA and VB6. While most Access and VB6 projects that use Jet use the DAO object model, ADO is also possible. This module shows common DAO tasks and then shows the equivalent ADO code.
SnippetQueries Example of browsing query objects as recordsets in a Jet/Access database using the Data Access Objects (DAO) object model in VBA and VB6.
 

Access Databases: Table and Records

Manage tables and data records from Microsoft Access databases for local and linked tables using ADO and DAO with VB6 and VBA. ADP support provided through ADO code.

ADOJetADOX Code that shows how to work with Jet/Access objects and information using the ActiveX Data Objects (ADO) object model in VBA and VB6.
ADOJetData Example code to work with table and query data in a Jet/Access database using the ActiveX Data Object (ADO) object model in VBA and VB6.
CreateTableDAO (class) Create a table in a Microsoft Access Jet database using VBA with DAO (not for creating tables in ADPs). Specify the fields and their data types, create primary and secondary indexes, set SubDataSheetName to None, allow text fields to accept zero length strings, set the CheckBox display for Yes/No fields, etc.
JetData (class) Properties and methods for working with data stored in Jet/Access databases using DAO for VBA and VB6. When you use VB6 to develop database applications, you have several choices for local database access: 1. Use the Data Control to access Jet/Access databases. 2. Write DAO code to work against Jet/Access databases. 3. Use DAO/Jet with linked tables for heterogeneous data access to disparate data sources such as FoxPro, xBASE and Excel. The functionality in this class enhances method #2, the use of DAO and Jet in program code to work with data.
JetLinkedTables (class) A class to create and refresh Microsoft Jet linked tables using DAO in VBA and VB6. This class makes it easy to work with multiple linked table objects without having to open and close the database each time.
JetLinkedTables From Microsoft Access, work with Microsoft Jet linked tables in the current database to link to external data sources using DAO in VBA. This module includes procedures for working with linked (attached) tables. Microsoft Jet provides a powerful mechanism for accessing external data sources. This technique allows you to create a permanent link to an external database or file without importing a copy of the data which may become outdated. Linked tables are useful because they make the external data source appear as a standard table in the database. This makes the management of data across disparate sources easy, and since links cache structure information about the external data source, accessing the data is usually faster than opening the external data source each time. You can even run (heterogeneous) queries among different data sources. A variety of data sources are supported: Microsoft Access/Jet databases, dBASE DBF files, Paradox db files, FoxPro DBF files, Excel spreadsheets, HTML files, Text Files, Exchange data, ODBC data sources, SharePoint lists.
JetRecordset (class) Working with Microsoft Jet recordsets with DAO in VBA and VB6. With this class you can open and close recordsets on a variety of data sources, and get advanced information about records and fields.
JetTableInfo Determine Microsoft Access/Jet database object information using DAO in VBA and VB6.
QueriesADO Create, execute, and browse Microsoft Access queries in the current project using ADO for MDB, ACCDB and ADP formats in Access VBA.
QueriesDAO Create, execute, and browse Microsoft Access queries using DAO/Jet in VBA and VB6.
RecordsetADO Use the ADODB database object to create recordsets from data objects and SQL strings in Microsoft Access for the current project (ACCDB, MDB, or ADP) using Access VBA.
RecordsetDAO Use DAO to create recordsets for Microsoft Access database objects from VBA or VB6.
TableCopyDAO Copy table structures (including complex fields) between tables using DAO in VBA and VB6.
TableCopyDataADO Copy records (excluding complex fields) using ADO in VBA and VB6.
TableCopyDataDAO Copy records (including complex fields) between tables using DAO in VBA and VB6.
TableModifyDAO Modify Microsoft Access tables to add, delete and rename fields; set starting number of autonumber fields; set table property for performance; and set field properties using VBA and VB6.
 

ActiveX Controls: Common Controls

Windows Common Controls for list view and tree view

ListView Routines to extend the functionality of the VB6 ListView control. The majority of the ListView enhancements are provided in the CListViewEnh class. This module contains a standalone procedure to load a DAO recordset into a ListView control. Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.
ListViewEnh (class) Work with the enhanced features of the MS ListView common control in VB6 and 32 bit VBA. This class acts as a wrapper for the common dialog ListView control. It provides several useful enhancements such as full-row select and sorting when the user clicks the column header when the ListView control is in report view. It allows you to specify additional styles such as check boxes and gridlines, as well as functions to set and get the value of the check boxes. Note that you must insert a ListView control onto a form in order to create a reference to the common controls library before the class will compile. Also note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.
TreeView Loading the TreeView Windows Common control with data and searching in VB6 and 32-bit VBA. The TreeView control is one of the components in the comctl32.ocx common controls custom control. It presents an expandable/collapsible hierarchical view of data. The routines in this module are used to load the treeview from arrays and recordsets, find strings, and collapse and expand the nodes of the TreeView. Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.
 

ActiveX Controls: Multimedia

Multimedia ActiveX Controls

WindowsMediaPlayer Routines for working with the Windows Media Player control in VBA and VB6.
 

Error Handling: VBA

Error Handling Routines for Microsoft Access and General VBA

ErrorHandlerAccess Global error handler for Microsoft Access VBA. Added to every procedure, these routines will trap, document, email, and gracefully exit your application when unexpected errors occur. A global error handler will help you improve the quality of your application by providing developers with the information necessary to diagnose problems and minimize the need for users to report crashes. The primary procedures for this module are CallStackAdd, CallStackRemove, and GlobalErrorHandler. For more information on error handling read our technical paper on Error Handling and Debugging Tips and Techniques for Microsoft Access, VBA, and VB6. See the declarations section for how to set the Total Visual SourceBook error handling options with this module. If line numbers are added to your VBA code, the error handler will document the line number where the crash occurs. Use the Code Delivery feature of Total Visual CodeTools to add line numbers to your code.
ErrorHandlerVBA (class) Global Error Handler for 32 and 64 bit VBA. This class provides a standardized error handling mechanism to trap errors, track the location and type of the errors, and to allow the programmer to take appropriate response. This version is VBA compatible--it contains no VB6 specific code. If you want the VB6 version, use the CErrorHandlerVB6 class.
 

Error Handling: Visual Basic 6

Error Handling Routines for Visual Basic 6 (VB6)

ErrorHandlerVB6 (class) Class that provides a standardized error handling mechanism to trap errors, track the location and type of the errors, and to allow the programmer to take appropriate response in VB6.
 

Excel: Automation

Excel automation

Excel (class) Create and modify Microsoft Excel spreadsheets (workbooks), worksheets, data ranges, cells, formats, margins, data from Access, spell checking, and PivotTables through VBA and VB6 automation. Microsoft Excel provides an automation server component, which allows most of the functionality in Excel to be called from an external program (e.g. Microsoft Access VBA, VB6, etc.). Note that Excel refers to a spreadsheet as a Workbook and the individual tabs in a workbook as Worksheets.
ExcelExport Basic data routines to export data from Microsoft Access to an Excel spreadsheet from a table, query, or SQL statement using DAO and ADO from VBA or VB6.
 

Excel: Examples

Examples of code running within Excel

SnippetAutoFilter Working with Excel AutoFilter objects in VBA and VB6. Excel allows you to filter cell data using the Filter, AutoFilter menu item. You can also access and create AutoFilter objects through VBA code. This module contains examples to access, modify, and use these AutoFilter objects.
SnippetExcel Working within Microsoft Excel using VBA.
SnippetQueryTable Retrieve data from an Access database and put it in your current Microsoft Excel spreadsheet using Query Table Objects. Excel makes it easy to insert data from other applications using Query Tables. You can also access and create Query Table objects through code. This module contains example code to show you how to programmatically work with Query Table objects.
 

General VBA/VB6: Abstract Data Types

Abstract Data Types such as bit arrays, dictionary, history lists, queues, and stacks

BitArray (class) Class that implements a bit array in VBA and VB6. A bit array is an array of bit values, defined as 0 or 1. This class allocates 1 bit for each value you wish to store, resulting in significant memory savings. For example, suppose you wanted to maintain an array of 100 Boolean values. A single Boolean requires 2 bytes of memory, resulting in 200 bytes of memory. Using the bit-array technique available with this class, only 13 bytes of memory are consumed. A zero in the bit array would represent False, and a 1, True.
Dictionary (class) This class uses the Dictionary object in VBA and VB6. Visual Basic 6 includes the Windows Scripting Host runtime component. This dynamic link library adds the ability to create and use Dictionary objects, which are similar to Collections, but are more powerful and can also be used in VBA. Unfortunately, several things are lacking in the Dictionary object, and the documentation provided with VB6 for this new object is thin at best. This class accomplishes three things: 1. Works around the bugs in the version of the Windows Scripting Runtime that ships with VB6. 2. Provides detailed examples of how to use the Dictionary object. 3. Provides additional functionality such as sorting the Dictionary.
HistoryList (class) Class that implements a history list in VBA and VB6. If you have ever used a web browser, you are already familiar with the concept of a History List. When you press your browser's Back button, you return the previous page you viewed. Similarly, when you press the Next button, you move to the page after the one you are currently on. This class implements the History List mechanism as a set of two stacks: a forward stack and a backward stack. The forward stack contains items that have been popped off the history list, whereas the backward stack contains items that have been pushed onto the history list. By maintaining these two stacks, the class keeps a history list that allows you to move back and forth through a history of items.
Queue (class) Class to implement a queue with a fixed or unlimited number of elements for VB6 and VBA. A queue is a restricted form of a list. All insertions occur at the end of the list, and all deletions at the front. An example of a queue is a waiting line where the last person is added to the rear of line and the first person served at the front. The queue data type defines three operations, EnQueue, DeQueue, and Front. - EnQueue places an item at the rear of the list. - DeQueue removes an item from the front of the list. - Front retrieves, but does not remove, an item from the front of the list. The queue is a FIFO, or First-In, First-Out, data type. This means that data enters at one end of the list, and exits from the other. This class is implemented using an array. When the array becomes full, the array index is reset to the beginning of the array and those elements are lost. The queue can also be unlimited by setting the WrapQueue property to False to preserve all items. This class supports object variables in addition to the standard text and numeric types.
Stack (class) Class that implements a stack with VB6 and VBA. A stack is a restricted form of a list. All insertions and deletions occur at one end of the list. The stack data type defines three operations, Push, Pop, and Top. - Push places an item on the top of the list. - Pop removes an item from the top of the list. - Top retrieves, but does not remove, an item from the top of the list. The stack is a LIFO, or Last-In, First-Out, data type. This means that data enters and exits from the same end of the list. An example of a stack is a spring loaded plate dispenser in a cafeteria. The last plate placed in the dispenser is the first one removed. This class is implemented using an array based approach. When the array becomes full, the array is grown by the amount specified in the GrowBy property. This class supports object variables in addition to the standard text and numeric types.
 

General VBA/VB6: Application Techniques

Common application development code for messages boxes, error handling, and shutting down windows

MessageBox Routines for simplifying the use of the built-in MsgBox function in VBA and VB6. Use these rather than calling the MsgBox command directly.
MsgBox (class) Wrapper class to simplify using Message Boxes in VBA and VB6. Coding MsgBox statement throughout your application can be a drudge. You have to set all the parameters for your message box and add a bunch of bits together to specify attributes. This class solves that problem by providing a very simple wrapper over the MsgBox command that exposes the message box as a set of properties and actions.
Shutdown (class) Shutting down Windows with options to restart and logoff in VB6 and VBA with 32 and 64 bit Windows API calls. This class allows you to shutdown Windows in one of four ways: Shutdown, Restart, Logoff, Shutdown with Power Off
 

General VBA/VB6: Data Integrity

Data integrity verification using 16 and 32 bit CRC (Cyclic Redundancy Check)

CRC16 (class) Calculate the 16-bit Cyclic Redundancy Check (CRC) of a file or string; can also be used for Checksum in VBA and VB6.
CRC32 (class) Calculate the 32-bit Cyclic Redundancy Check (CRC) of a file or string; can also be used for Checksum in VBA and VB6.
 

General VBA/VB6: Data Type and Unit Conversion

Convert among different types of data such as bit operations, units of measure

AsciiBinaryHex Convert ASCII characters, numbers, and hexadecimal values, encode URL characters and generate HTML colors using VBA and VB6.
BitOps Routines for bitwise and unsigned data manipulation using VBA and VB6. Visual Basic does not provide any native methods for performing bitwise manipulation, nor does it provide unsigned data types. This module offers routines for bit shifting, bit setting, clearing bits, unsigned assignment operations, and extracting components of variables.
DataConversion Convert data types within VBA and VB6.
EBCDIC Convert between ASCII characters and Extended Binary Coded Decimal Interchange Code (EBCDIC) using VBA and VB6. EBCDIC is an 8-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems. Visit http://en.wikipedia.org/wiki/EBCDIC for more information.
UnitConversion Convert units of measurement such as degrees, distance, volume, and calendar dates in VBA and VB6.
 

General VBA/VB6: Date and Time

Date and time routines, including business day math

AgeBirthdays Calculations for age, birthdays, anniversaries, and days since the last one or until the next one using VBA and VB6.
BusinessDatesFile (class) Business day math (taking holidays into account) with holidays stored in a file in VBA and VB6.
BusinessDatesTableADO (class) Business day math (taking holidays into account) with holidays stored in a table using ADO to support ACCDB/MDB/ADP database formats for VBA and VB6
BusinessDatesTableDAO (class) Business day math (taking holidays into account) with holidays stored in a Microsoft Access/Jet table using DAO for VBA and VB6 (does not support ADPs).
DateTime

See sample Date Time Age code

Date and time calculations for adding and subtracting dates, day of week or month, quarters, ISO week numbers, date/time parts, translating time to words, etc. using VBA and VB6. VBA and VB6 provides many useful functions such as DateAdd, DateDiff, DateSerial, etc. for dealing with date and time values.
MMTimer (class) Simulate the action of a stop watch by using a high-resolution timer, in VB6 and VBA with 32 and 64 bit Windows API calls. This class uses a high-resolution multi-media timer to track elapsed time. This class is useful for timing user operations, or for bench-marking your applications. Because it uses the Windows multimedia timer, it uses much higher resolution than the built-in VBA/VB6 Timer function.
Waiting Wait for a period of time or until a particular time using VBA and VB6. Uses the Windows API Sleep command to avoid the DoEvents command in a loop that eats up all your CPUs. Includes support for 32 and 64 bit API calls. For more information, read our paper Avoid Using DoEvents to Wait.
Year2000 Year 2000 four digit year displays and the two digit pivot year for VB6 and VBA with support for 32 and 64 bit API calls.
 

General VBA/VB6: Encryption and Compression

Encryption and compression operations

Encryption (class) Encrypt and decrypt files and strings with Unicode support using XOR password encryption in VBA and VB6. The password is also encrypted as the string or file is processed, providing an additional level of security. For simple string encryption, consider using modEncryption instead.
Encryption Encrypt and decrypt a Unicode or ASCII string using XOR password encryption in VBA and VB6. Similar to class CEncryption but simplified for function calls and no progress events.
Huffman (class) Class that implements Huffman compression for files in VBA and VB6. Huffman compression uses character frequencies to compress data. Bit codes are assigned to each character, with shorter bitcodes for more common characters, and longer bitcodes for the less common characters.
LZ (class) Class that implements Lempel-Ziv compression to compress files and strings in VBA and VB6. LZ compression, also known as sliding window compression, uses redundancy to compress data. As data is read, a dictionary of previous data is kept in memory. If a string of characters in the input data matches an entry in the dictionary, a code pointing to the dictionary entry is written to the output. If a match is not found in the dictionary the plain character is sent to the output.
RLE (class) Class that implements run length encoding (RLE) to compress files and strings with VB6 and VBA. Run Length Encoding algorithms reduce strings of recurring characters to a single character, followed by a count of how many times the character occurred.
UUEncode (class) Class that encodes and decodes files using UU Encoding with VB6 and VBA. UU Encoding is an algorithm for converting binary data to 6-bit ASCII. This is often needed to send binary files through internet mail gateways. UU Encoding is also commonly used in internet newsgroups for posting binary data. UU Encoding breaks a group of 3 eight bit characters (24 bits) into 4 six bit characters (also 24 bits) and then adds 32 (a space) to each six bit character. This maps it into a transmittable character set. These characters are: !"#$%&'()*+,-./ 0123456789:;=? @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
ZipFile Create compressed zip files, list the files in a zip file, and extract/unzip all files or individual files from zip files with file overwrite options using VB6 and VBA in 32 and 64-bit. Code references the Microsoft Shell Object without requiring it to be added as a library reference to your project.
 

General VBA/VB6: Math

General math and routines for area and volume, statistics, and trigonometry

MathAreaVolume Math routines for calculate the area and volume of various objects in VBA and VB6.
MathGeneral General math routines for VBA and VB6 such as rounding, factorials, and determining the minimum and maximum values from a set of numbers. The code in this module also addresses rounding errors that exist in VBA/VB6 functions. VBA/VB6 has built-in functions for various mathematical operations. Search online help for "Math Functions" and "Derived Math Functions" for more information.
MathStatistics Mathematical functions covering the areas of statistics and probability in VBA and VB6. This category contains various math routines covering the areas of statistics and probability. VBA has built-in functions for various mathematical operations. Search online help for "Math Functions" and "Derived Math Functions" for more information
MathTrigonometry Trigonometry functions for working with values such as cosines, tangents and secants in VBA and VB6.
 

General VBA/VB6: Multimedia

Multimedia support for AVI and WAV files, CD and MIDI devices, and telephone/modem TAPI

AVI32 (class) Play AVI files using the MCI (media control interface) 32-bit Windows API for VB6 and 32 bit VBA. This class allows you to interact with AVI movies without using the Microsoft Multimedia Control. This class also allows you to play movies on your form. With the Microsoft Multimedia Control you can only play movies in a separate window. It does not support Windows 64-bit VBA.
CD (class) Class to provide an interface for controlling a CD player without using the Microsoft Multimedia Control. Includes support for VB6 and VBA 32 and 64 bit API calls.
Multimedia Routines for working with multimedia devices in VB6 and VBA with 32 and 64 bit Windows API calls. The module contains miscellaneous multimedia functions dealing with waveform audio files. The routines allow you to play or stop playing Windows .WAV files, to get and set the volume levels for wave devices, and to determine whether your user's machine supports waveform audio.
TAPI Dialing numbers with the modem via Telephony Application Programming Interface (TAPI), with support for 32 and 64 bit API calls TAPI needs to be installed on the PC.
WAVMID (class) Play WAV and MIDI sound files and record WAV files using the MCI (media control interface) API. Includes support for VB6 and VBA with 32 and 64 bit Windows API calls. This class allows you to interact with WAV or MIDI files without using the Microsoft Multimedia Control.
 

General VBA/VB6: References

Managing Library References

References Manage library references from VBA projects
 

General VBA/VB6: Searching and Sorting

Searching in and sorting strings and arrays

BoyerMoore (class) Class that implements Boyer-Moore string searching using VBA and VB6. The Boyer-Moore string-searching algorithm provides a highly optimized method for searching for a sub-string within a string. The Boyer-Moore algorithm takes advantage of its knowledge of the string being searched for. By doing this, it is possible to search a string without examining all the characters in the string.
FuzzyStringSearch (class) Approximate text matching using fuzzy string searching in VBA and VB6.
MetaPhone (class) Class that implements the metaphone string searching algorithm in VBA and VB6. The metaphone algorithm is similar to the Soundex algorithm but tends to group names together that are more closely related than Soundex does. However, metaphone also tends to produce more matches than Soundex. Similar to Soundex, the metaphone algorithm generates a key value for a word based on the consonants in that word. Metaphone uses more intelligent transformation rules, though, by examining groups of letters, or diphthongs.
Search Binary and Linear Search routines and Soundex function in VBA and VB6.
Sort Sort a array using a BubbleSort, QuickSort, or ShellSort algorithms in VBA and VB6.
SortCollection Sort a Collection using a BubbleSort algorithm in ascending or descending order in VBA and VB6.
 

General VBA/VB6: String Handling

String handling to concat, evaluate expressions, use tokens, and parse strings

ConCat (class) High performance concatenation of large strings in VBA and VB6. When concatenating large strings on the order of 50kb or larger (for example, building an RTF string), the length of time to complete becomes exponentially longer. This is because Visual Basic re-allocates the string each time it is concatenated. This class implements an alternative to normal concatenation that does not re-allocate the string each time it is concatenated.
EmailValidation Verify an email address or set of email addresses conforms to standards in VBA and VB6.
ExpressionEvaluator (class) Class to implement expression evaluation in VBA and VB6. Expression evaluation is a common need in many programs, especially if you deal with numbers and operators.
PhoneButtonLetters Convert between phone numbers and their corresponding button letters using VBA and VB6.
StringNumbers Convert currency numbers to full word text for check writing and Roman numerals with VBA and VB6.
Strings Manipulate, parse, clean, capitalize and count strings using VBA and VB6.
Tokenizer (class) Breaking and parsing a string into individual tokens with VB6 and VBA. This tokenizer is implemented as a state machine. The characters used for whitespace, separators, quotes, and end-of-line are all implemented as properties. This allows for a great deal of flexibility in how text is tokenized.
 

Geospatial: Addresses and Distances

Determine the distance between locations and convert locations names and addresses to GPS latitude and longitude, determine its type, and retrieve its components such as street number, street, city, state, postal code, country, county, etc.

Distance Measure the distance between two latitude and longitude coordinates using the spherical law of cosines or Haversine formula in VBA or VB6. Due to the curvature of the earth, the distance between two points is not a straight line. These routines calculate the distance over the earth as a sphere.
GoogleMapsAPI Use the Google Maps web service API to translate street address to GPS latitude and longitude coordinates, and other address components using VBA or VB6.
 

Geospatial: Google Earth

Automate Google Earth by creating KML files to show locations, points of interest, lines between points, and animated tours for VBA and VB6

GoogleEarthPoints (class) Create a Google Earth KML file by adding location placemarks, advanced custom HTML descriptions, icons, and colored line segments, then launch Google Earth with it using VBA or VB6. Requires Google Earth to be installed and the default program when a KML file is opened.
GoogleEarthTour (class) Create a Google Earth KML file to generate an animated tour by adding locations and wait times, then launch Google Earth with it using VBA or VB6.
 

Geospatial: Mapping

Automate Google Maps and Bing Maps to show points of interest, directions between locations, and set display options with VBA and VB6

MappingBing Use Bing Maps (http://www.bing.com/maps) to show addresses, directions (driving, transit, walking), and display options in VBA or VB6
MappingGoogle Use Google Maps (http://maps.google.com or http://maps.google.com/maps) to show addresses, directions (driving, transit, walking, biking), and display options in VBA and VB6.
MappingMapquest Use MapQuest (http://www.mapquest.com) to show addresses and driving directions in VBA and VB6
 

Geospatial: Zip Codes

Lookup City and State values from a zip code lookup table using DAO and ADO with VBA and VB6

ZipCode_ADO (class) Use ADO to lookup a zip code's corresponding city and state from a zip code table in VB6 and VBA. FMS, in conjunction with the USPS, offers a monthly subscription to current US zip codes. See Total ZipCode Database for details.
ZipCode_DAO (class) Use DAO to lookup a zip code's corresponding city and state from a zip code table in VB6 or VBA. FMS, in conjunction with the USPS, offers a monthly subscription to current US zip codes. See Total ZipCode Database for details.
 

Internet/Web: HTTP/FTP

Use Internet transfer protocols such as HTTP and FTP (File Transfer Protocol) from VBA and VB6 with 32 and 64-bit API calls

InternetFTP (class) Use File Transfer Protocol (FTP) standards to open connections and sessions on a remote FTP site, download (get) files, create directories, upload (put) files, delete and rename files and directories. Includes support for VB6 and VBA with 32 and 64 bit API calls. This class works directly through the WININET.DLL library which exists if Internet Explorer is installed and does not need to be a library reference. This means you can distribute simple FTP functionality with your application with little overhead.
InternetHTTP (class) Create Internet HTTP connections and sessions and retrieve HTML page sections and text. Includes support for VB6 and VBA 32 and 64 bit Windows API calls. You can use the functionality in this class to query HTTP servers, request and send data, and manage HTTP sessions. This class works directly through the WININET.DLL library, so it requires no additional OCX or control files. This means you can distribute simple HTTP functionality with your application with little overhead. WININET.DLL is part of Internet Explorer.
 

Internet/Web: Internet/Web

Using Internet web sites for searching Bing, Google, Yahoo, YouTube, retrieving current stock quotes, get a TinyURL and send Twitter messages using VBA and VB6

Bitly (class) Use the Bit.ly web service to convert a long Internet URL string to a short one and vice versa with VBA and VB6. Bit.ly is used by Twitter to shorten URLs in tweets. For your own use, a single Bit.ly access token can be used for OAuth authentication. This is free from: https://bitly.com/a/oauth_apps. To support other users, a Bit.ly user name and API Key is required. This is free from: https://bitly.com/a/your_api_key.
InternetSearch Internet search using VB6 and VBA to launch a web browser with Bing, Google, Yahoo, and YouTube to perform global searches and specific searches for books, finance, images, news, sports, videos, weather, etc. while properly formatting the URL search string.
StockQuotes Retrieve current stock quotes from the Yahoo! Finance website in VBA and VB6
TinyURL Use the TinyURL.com web service to convert a long Internet URL string to a short one with VBA and VB6
TwitterSearch Search for tweets (posts/messages) on Twitter.com using VBA and VB6.
 

Office: Automation

Office Automation

OfficeCommandBars Routines for working with command bars in Microsoft Office applications and files using VBA.
 

Outlook: Automation

Microsoft Outlook Automation

OutlookAddressBook (class) Working with the Microsoft Outlook Address Book and the Exchange Server Global Address List through Automation using VBA and VB6.
OutlookCalendar (class) Working with Microsoft Outlook Calendars through Automation using VBA and VB6.
OutlookContacts (class) Working with Microsoft Outlook Contacts through Automation using VBA and VB6.
OutlookFolders (class) Working with Microsoft Outlook Folders through Automation using VB6 and VBA. Compatible with 32 and 64-bit VBA. This is similar to COutlookFolders32 without the use of the 32-bit Common Controls of MSComCtl32.ocx.
OutlookFolders32 (class) Working with Microsoft Outlook Folders through Automation using VB6 and VBA (32-bit only). Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.
OutlookMail (class) Working with Microsoft Outlook Mail Items through Automation using VBA and VB6.
OutlookNotes (class) Working with Microsoft Outlook Notes through Automation using VBA and VB6.
OutlookTasks (class) Working with Microsoft Outlook Tasks through Automation using VBA and VB6.
 

PowerPoint: Automation

Working with an instance of a PowerPoint presentation through Automation

PowerPoint (class) A set of methods and properties to easily work with Microsoft PowerPoint through automation using VBA and VB6.
 

SharePoint: Databases

Working with Access databases on SharePoint

SharePointDatabases Routines for working with Access databases on SharePoint from Access VBA.
 

SQL Server: SQL Server

Working with SQL Server database objects in VB6 and VBA

ADOConnODBC (class) Class to support client/server operations using ADO with any ODBC connection in VBA and VB6. This class sets up an ADO connection object for any ODBC connection. Use this connection if a native OLE DB driver is not available for your data source.
ADOConnSQLServer (class) Class to support SQL Server operations using ADO in VBA and VB6. This class sets up an ADO connection object for use with a Microsoft SQL Server database using the native OLE DB driver.
ADOSQLServer Working with SQL Server via ADO in VBA and VB6.
DataLinkDialog Open the Data Link Properties dialog to get ADO connection strings for sources like SQL Server in VBA and VB6.
JetODBC (class) Class to support client/server operations using Microsoft Jet to manage the ODBC layer in VBA and VB6. This class supports client/server operations using Microsoft Jet to manage the ODBC layer. When using Visual Basic to deploy client/server applications, you have a variety of development choices. You can use DAO and Jet, DAO and ODBC Direct, RDO and the Remote Data Control, or program directly against the API. This class exposes functionality to use DAO and Jet against ODBC data sources. For information on the other choices, see the other classes in the Database category. Many client server applications developed using Microsoft Access and Visual Basic use the DAO/Jet method for remote data access. Using Microsoft Jet, you make calls to the remote server using standard DAO procedures. Microsoft Jet manages the translation between the MDB file format objects and the server objects.
RDOConnection (class) Class to support client/server operations using the Remote Data Access to set up an ODBC connection to a data source using VB6 and VBA. When using Visual Basic to deploy client/server applications, you have a variety of development choices. You can use DAO and Jet, DAO and ODBC Direct, RDO and the Remote Data Control, or program directly against the API. This class exposes functionality to use RDO against ODBC data sources. For information on the other choices, see the other classes in the Database category. This class was designed and tested against an ODBC connection using Microsoft SQL Server. The behavior with other servers may be slightly different. Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the 32 bit library MSRDO20.DLL. RDO was designed specifically to access remote ODBC relational data sources, and made it easier to use ODBC without complex application code. It was included with Microsoft Visual Basic versions 4, 5, and 6. RDO version 2.0 is the final version of this technology.
RDOData (class) Class to support client/server operations using Microsoft's Remote Data Objects (RDO) technology with VB6 and VBA. This class uses an existing rdoConnection to perform queries, create resultsets, execute stored procedures etc. When using Visual Basic to deploy client/server applications, you have a variety of development choices. You can use DAO and Jet, DAO and ODBC Direct, RDO and the Remote Data Control, or program directly against the API. This class exposes functionality to use RDO against ODBC data sources. For information on the other choices, see the other classes in the Database category. This class was designed and tested against an ODBC connection using Microsoft SQL Server. The behavior with other servers may be slightly different. Note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the 32 bit library MSRDO20.DLL. RDO was designed specifically to access remote ODBC relational data sources, and made it easier to use ODBC without complex application code. It was included with Microsoft Visual Basic versions 4, 5, and 6. RDO version 2.0 is the final version of this technology.
SnippetADOSQLServerRst Example working with SQL Server recordsets via ADO using VBA and VB6.
 

Visual Basic 6: Application Techniques

VB6 Application Techniques

CommandArgs (class) Class to parse information contained in a string into individual parts that can be tested in VBA and VB6.
Hourglass (class) Wrapper class that implements an alternative way to show an hourglass in VB6. One of the problems that can arise when using an hourglass is not setting the cursor back to the default. This class avoids that problem by automatically setting the cursor back to the default when it terminates.
VB_Application Routines for working with modules and the IDE in VB6. This includes handling chores such as ensuring that all forms in the application are closed before exiting, and testing the open status of forms in your and other applications.
 

Visual Basic 6: Controls

Code for working with VB6 controls

ComboBox Routines to extend the functionality of a standard Visual Basic 6 (VB6) ComboBox control. Some of these procedures expose features which are inherent in the Windows control, but are not exposed by VB6 (such as the ability to set the dropdown list width). Other procedures add entirely new functionality such as loading a DAO recordset into an unbound combo box.
DateTimePicker (class) Implement the DateTime Picker Windows common control in VB6. This class implements routines for creating and manipulating the date time control from Internet Explorer's common control library.
IPAddressInput (class) Class that implements the IP Address Input Windows common control in VB6. This class implements routines for creating and manipulating the IP Address control in the Internet Explorer common control library. This class requires version 4.71 or later of COMCTL32.DLL. Please note that you cannot simply redistribute COMCTL32.DLL with your application.
ListBox Routines to extend the functionality of the standard Visual Basic 6 (VB6) ListBox control. Some of these procedures expose features which are inherent in the Windows control, but are not exposed by VB6 (such as the ability to set add scrollbars or to set the height of items in the list.) Other procedures add entirely new functionality such as loading a DAO recordset into an unbound list box.
TextBox Routines to extend the functionality of the standard Visual Basic 6 (VB6) TextBox control. Some of these procedures expose features which are inherent in the Windows control, but are not exposed by VB6 (such as the ability to set a bounding rectangle, or to force input to a certain case). Other procedures add entirely new functionality such as filtering keystrokes, or selecting text.
ToolBar Routines for manipulating toolbars in VB6. Set the toolbar to the flat style, the same style as Visual Basic toolbars. This functionality is not built into the Windows Common Control ActiveX Control.
ValidateControl (class) Class that provides the ability to perform validation on controls in their LostFocus events in VB6. Many people assume that it is easy to validate VB6 controls in the LostFocus event. Unfortunately, this can be quite a problem. Consider two text boxes: Text1 and Text2. Both have code in their LostFocus events to check for valid data enteries. When the user tabs out of Text1, the LostFocus event fires, so the programmer displays a message box and attempts to set the focus back onto Text1. However before going back to Text1, Text2 receives GotFocus and LostFocus events. Unless the value in Text2 is already correct, the validation code in Text2 fires, and the user is stuck in an endless loop. This class keeps a state variable to track whether a validation test is currently executing. If a validation routine for Text1 is being performed, Text2 will NOT fire its validation messages, even if the validation for Text2 fails.
 

Visual Basic 6: Forms

Working with Forms in VB6

CaptionlessWindowMover (class) Class that allows the user to move a form with the mouse, even if it doesn't have a caption in VB6. If you create a form without a caption bar, there is normally no way for the user to move it with a mouse. If you wish to allow the user to move the form with a mouse by dragging on any part of the form, not just the caption, you can use this class to handle the mouse-related events required to make this happen.
FormPos (class) A form class to position a form on a screen in VB6. Easily save a form's position to the Windows registry, then restore it to its previously saved position. You may also center a form or move it to a specified location. This class uses the Windows registry location based on the specified RegistryPath and RootKey properties.
OpenForm (class) Class that open Forms via a string reference in VB6. Visual Basic does not allow you to open and show a form based on a string or a variable containing the name of the form. This class lets you create a collection of the forms in your application, and then refer to them via strings or variables.
VB_Forms Routines to enhance the behavior and features of forms in Visual Basic 6 (VB6)
 

Visual Basic 6: Graphics

Creating graphics using the Windows API and native VB6 commands

ChangeRes (class) Changing monitor screen resolutions in VB6. This class supports functionality to list all available video modes and switch to the desired mode. Since some mode changes require a shutdown of Windows, this is also supported.
Fractal Routines for drawing fractals, including the Mandelbrot and Julia fractals in VB6.
GDIArc (class) Class that draws an arc, using Windows API GDI calls in VB6. An arc is a line segment of an ellipse. The routines in this class allow you to draw the arc by calling the Windows API Arc function.
GDIChord (class) Class that draws a Chord, using Windows API GDI calls in VB6. A chord is a region bounded by the intersection of an ellipse and a line segment, called a "secant". Imagine an arc whose end-points are connected by a straight line.The routines in this class allow you to draw the chord by calling the Windows API Chord function.
GDIEllipse (class) Class that draws an ellipse, using Windows API GDI calls in VB6. An ellipse is a circle or oval region whose center is located in the middle of an imaginary bounding rectangle. The routines in this class allow you to draw the ellipse by calling the Windows API Ellipse function.
GDIFloodFill (class) Class that fills an area using Windows API GDI calls in VB6. The Windows API FloodFill function fills a region of the form or picture which is bounded by a solid line of pixels of the same color. It is often used to "color in" parts of the form. The routines in this class allow you to use the Windows API FloodFill function.
GDILine (class) Class that draws a line, using Windows API GDI calls in VB6. A line is a series of pixels drawn between two points on the screen. The routines in this class allow you to draw the line by calling the Windows API LineTo and MoveToEx functions.
GDIPie (class) Draw pie segments or a complete pie using Windows API GDI calls in VB6. A pie segment is a wedge bounded by the intersection of an ellipse and two radials. The ellipse is drawn within an imaginary bounding rectangle. This class uses the Windows API Pie function to draw the pie segments.
GDIPolygon (class) Class that draws a polygon, using Windows API GDI calls in VB6. This class lets you draw an arbitrary polygon made up of a collection of straight-line segments, whose end-points are specified by the X and Y position in pixels. Specify the number of points in the polygon by setting the PointCount property. Then set the points between 1 and PointCount to valid X and Y point positions. The routines in this class allow you to draw the shape by calling the Windows API DrawPolygon function.
GDIRectangle (class) Class that draws a rectangle, using Windows API GDI calls in VB6. A rectangle is a region whose location is determined by the Left, Top, Right and Bottom properties of this class. The angles of the corners of the rectangle are always drawn at 90 degrees. The routines in this class allow you to draw the rectangle by calling the Windows API Rectangle function.
GDIRoundRect (class) Class that draws a rounded rectangle, using Windows API GDI calls in VB6. A rounded rectangle is a region whose location is determined by the Left, Top, Right and Bottom properties of this class. The angles of the corners of the rectangle are always drawn at 90 degrees. The corners of the rectangle are rounded off based on the value of the Height and Width properties. The routines in this class allow you to draw the rounded rectangle by calling the Windows API RoundRect function.
Graphics Routines for creating graphics, primarily with Windows API calls in VB6. The majority of the procedures in this module enhance VB6's built-in graphics handling capabilities by allowing you to call routines in the Windows API to create graphical effects on your forms and other objects. Routines such as GradientFill, DrawControlEdge and RotateText actually place graphical objects on your forms. Other routines in this module perform numerical or calculated transformations only, or retrieve graphical information, such as the TranslateVBColor, GetRedValue and GetPixelColor functions. These functions do not produce any output, but they are useful helper functions for working with VB6 graphics.
ScreenCapture (class) Screen capturing windows and forms to a picture with VB6.
SimulatedControls Routines to draw simulated controls Visual Basic 6 (VB6). Windows contains a function "DrawFrameControl" to create an image of several standard Windows "widgets" -- check boxes, menu items, scroll bar controls and so forth. The functions in this module expose this function to your application. You might want to use these simulated controls for several reasons. Perhaps you are creating documentation of the appearance of a form, and you wish to create a graphic you can display or print. You might be creating lightweight "graphical" user controls and wanting to draw the appearance of the controls on your user control rather than using an actual control. Because the controls are drawn by Windows, their appearance depends on the users' Windows color and font preferences.
 

Visual Basic 6: Menus

Visual Basic 6 Menu objects

Menus Visual Basic 6 (VB6) menu routines
MRU (class) Maintain a "Most Recently Used" menu items on a Visual Basic 6 (VB6) form with the use of Windows Registry entries. This class is commonly used to store the "Most Recently Used" file list for menu items on a form, but the list of items does not have to be a list of files. It could be used for any unique items you wish to store and display on a form's menu.
 

Visual Basic 6: Printing

Print using the Windows API and native VB6 commands

APIPrinter (class) Working with the printer using the Windows API in VB6.
VB_Printer Enhanced features for working with Printers in Visual Basic 6 (VB6)
 

Windows: Clipboard Operations

Windows Clipboard Cut, Copy, and Paste using VBA and VB6.

Clipboard Working with the Windows Clipboard in VB6 and VBA with 32 and 64 bit Windows API calls. Use this code to get the contents of the clipboard, copy text to the clipboard, or clear the contents of the clipboard.
 

Windows: Common Dialogs

Displaying Windows Common Dialogs for Colors, Files, Folders, Fonts, Printers, and Page Setup using VB6 and VBA with 32 and 64-bit API calls.

BrowseForFolder Launch the Windows Browse for Folder dialog to select an existing folder and/or create a new folder in VB6 and VBA with 32 and 64 bit Windows API calls. For VBA, the modFileDialogVBA includes a VBA_FileDialog_GetFolder function which avoids the use of Windows API calls and is simpler to use though it has fewer features.
ColorDialog (class) Displaying the Windows Choose Color Common Dialog in VB6 and VBA with support for 32 and 64 bit API calls
FileDialog (class) Displaying the File Open/Save Common Dialog for VB6 with VBA support for 32 and 64 bit API calls.
FileDialog Displaying the File Open/Save Common Dialog in VB6 and VBA with 32 and 64 bit Windows API calls. A set of pre-defined File Masks are included to simplify the selection of file types. For VBA, you can use the modFileDialogVBA which avoids the use of Windows API calls.
FileDialogVBA Use the File Open, File Save, and Folder Open Dialogs using the built-in VBA FileDialog command without using the Windows API calls. Supports 32 and 64-bit VBA. The VBA FileDialog command is not as full featured as the Windows API approach but is much easier to use. A set of pre-defined File Masks is included to simplify the selection of file types. For the Windows API routines, use the modFileDialog module which also supports VB6.
FontDialog (class) Displaying the Font Common Dialog without using the Microsoft Common Dialog Control in VB6 and VBA with support for 32 and 64 bit API calls.
PageSetupDialog (class) Display the Page Setup Common Dialog using PageSetupDlgA in VB6 and VBA with 32 and 64 bit Windows API calls.
PrintDialog (class) Displaying the Print Common Dialog without using the Microsoft Windows Common Dialog Control in VB6 and VBA with 32 and 64 bit Windows API calls.
 

Windows: File and Disk Operations

Managing disk drives, files, paths, folders, and subfolders with and without Windows API calls using VBA and VB6.

APIDisks (class) Class for working with disk drives using the Windows API for VB6 and 32 and 64 bit versions of VBA. Although Visual Basic has rudimentary file and disk functionality, you must go to the Windows API to get real power in this area. This class exposes logical drives through a collection of properties and methods, including support for: - Enumerating all logical drives. - Getting drive information such as volume label, free and total space, serial number and more. - Determining if a drive is ready. - Changing a volume label.
APIFilesAndPaths Working with drives, paths, and files in VB6 and VBA with 32 and 64 bit Windows API calls.
FileDisk File, directory and disk manipulation routines to copy, delete, and move files, folder and subfolders using built-in functions in VB6 and VBA 32 and 64 bit.
ShellExecute (class) Class that uses the Windows Shell to launch, print, or explore files or programs in VB6 and VBA with 32 and 64 bit Windows API calls. The routines in this class allow you to use the Windows shell to perform a variety of file execution operations. For example you can copy a file or group of files and have the Windows shell provide an animated progress display. You can send files to the Recycle Bin with full confirmation support.
ShellFileDisk Windows shell routines to work with folder and disk in VB6 and VBA with 32 and 64 bit Windows API calls. The Windows Shell user interface exposes its functionality through a variety of functions exported from the SHELL32.DLL library. This module makes it easy to use this functionality in your applications.
 

Windows: Fonts

Fonts stored in Windows and their sizes using VBA and VB6.

Fonts Get the list of fonts installed on Windows, see if a font name is installed, and convert between points and height. Supports VB6 and VBA with 32 and 64 bit Windows API calls.
 

Windows: Help Files

Managing Help files (*.HLP and *.CHM formats) using VBA and VB6.

HelpHTML Working with Windows HTML Help files (usually named *.CHM or *.HTML) in VB6 and VBA with 32 and 64 bit Windows API calls. Microsoft Access forms have a HelpFile property that supports legacy *.HLP format files, but not the newer *.CHM help file format.
WinHelp (class) Working with Windows Help (*.HLP) files in VB6 and VBA with 32 and 64 bit Windows API calls. Code is included for opening, searching and closing help files. You can also open "Help on Help", contents pages, the help index, and run macros stored in help files. HLP format help files have been replaced by the more secure CHM help file format. Your Windows settings may prevent the ability to open an HLP file. Many of the Office and Visual Basic products provide tools for searching and displaying help files, but the VBA/VB6 solution is based on the use of the Common Dialog control. If your application is already using the Common Dialog control, it makes sense to use the Help facilities that VB offers. However, if you aren't using this control, and you need to implement support for Windows Help, this class is a better solution. Its size is obviously much smaller than the Common Dialog control, and its operation is very simple.
 

Windows: INI File

Working with Initialization (*.INI) files using VBA and VB6.

INIFile Windows Initialization (INI) files code in VB6 and VBA with 32 and 64 bit Windows API calls. Initialization (INI) files are the primary mechanism that 16-bit Windows programs use to store setting information. Additionally, Windows itself stores its settings for the most part in various INI files in the Windows directory. Even in the 32-bit world, INI files are still used. This category contains procedures to read and write INI file values in both the built-in Windows files and your own custom INI files. Windows splits INI file access into two categories: 1. INI Operations: all operations are hardcoded to go to the WIN.INI file located in the Windows directory. 2. Private INI: all operations work on the INI file specified in the call. Use the "private" INI functions to work with all INI files other than WIN.INI. Interestingly, you can use the "private" INI functions on WIN.INI by specifying WIN.INI as the file to work with.
 

Windows: Registry

Managing the Windows System Registry using VB6 and VBA with 32 and 64-bit Windows API calls

ProgramSettings (class) Simplified registry access routines used for saving program settings in VB6 and VBA with 32 and 64 bit Windows API calls. This class is designed to store information about a single program to a single location in the Windows registry. Typically it is used to store program-specific run-time settings or switches such as form locations, or most-recently-used menu items.
Registry Routines for manipulating the registry (add, edit, delete, enumerate, and find registry keys and values) for VBA with support for 32 and 64 bit Windows API calls
Registry32 Routines for manipulating the registry (add, edit, delete, enumerate, and find registry keys and values) for VB6 and VBA using 32 bit Windows API calls
 

Windows: System Information

System information for the computer CPU, keyboard, memory, mouse, operating system, printers, and system folders for VBA and VB6.

ComputerInfo (class) Obtain computer CPU system information and processor features with support for 32 and 64 bit API calls using VBA and VB6.
KeyboardInfo (class) Manage keyboard settings such as caps lock and num lock states, with support for 32 and 64 bit API calls using VBA and VB6.
MemoryStatus (class) Retrieve memory status information such as total and available memory, with support for 32 and 64 bit API calls using VBA and VB6
MouseInfo (class) Manage the mouse and its properties in VB6 and VBA with 32 and 64 bit Windows API calls.
OSInfo (class) Obtain information from the Windows operating system in VB6 and VBA with 32 and 64 bit Windows API calls.
PrinterWindows Manage the Windows printer settings using the Printer object in VB6 and Microsoft Access (with support for 32 and 64 bit API calls). Note that a printer object does not currently exist in VBA for Microsoft Excel.
SystemFolders Retrieve and create system and user folders in VB6 and VBA with 32 and 64 bit Windows API calls.
 

Word: Automation

Microsoft Word Automation

Word (class) Use Microsoft Word Automation to create, edit, save, and output Microsoft Word documents from VBA and VB6. Word supports interacting with it as an automation server, and for working with documents. Create new or open a Word document, add paragraphs and text, set formatting settings, import files, insert Access data from tables, save, print, preview, and password protect the Word document, create PDF files.
WordConversion Convert Microsoft Word documents from one format to another using VBA and VB6.
WordMerge (class) Use Microsoft Word Automation to combine data from a Microsoft Access data source (table, query, or SQL string) to a Word file for mail merge from VBA and VB6.
 

XML Files: XML Files

XML File Creation, Reading, Parsing and Displaying

SnippetXML Example code that shows how to create, read, and search an XML document using VBA and VB6.
XMLADO (class) Convert an ADO Recordset to XML using the Microsoft XML Parser with VB6 and VBA. This class allows you to convert an ADO Recordset to an XML document or load an XML document created with this class, back into an ADO Recordset.
XMLFileCreate (class) Create an XML file using the DOMDocument MSXML.DLL object with encoding to support Unicode from VBA and VB6. Easily specify the root, add items, add elements (nodes), and add items and elements to elements
XMLFileRead (class) Read an XML file or text string using the DOMDocument MSXML.DLL object from VBA and VB6. Easily read the root, elements (nodes) for children and sibling nodes. Examples show how to read the entire file and search for specific nodes.
XMLSettings (class) Save and read application settings to and from an XML File with VB6 and VBA.
XMLTreeView (class) Populate a Microsoft TreeView control with the contents of an XML file by using the XML Document Object Model (as provided through the Microsoft XML Parser components) for VB6 and 32-bit VBA. Note that due to limitations of the treeview you will receive errors if the treeview node count exceeds 32767. Also note that this code is not supported in the 64-bit version of Access 2010 or 2013 due to the use of the Common Controls of MSComCtl32.ocx.

Additional Resources

Feedback

Contact Us  l   Web questions: Webmaster   l   Copyright FMS, Inc., Vienna, Virginia
Celebrating our 28th Year of Software Excellence