Unlocking the Microsoft Forms 2.0 Object Library in VB6 If you are maintaining legacy Visual Basic 6 (VB6) applications or writing VBA macros, you have likely encountered the Microsoft Forms 2.0 Object Library (FM20.DLL). While it is primarily designed for Office UserForms, it offers a suite of versatile controls and features that can be highly useful in specialized scenarios. Key Benefits and Features
The Forms 2.0 Library provides a different set of tools compared to the standard VB6 intrinsic controls.
Enhanced Control Set: Access a variety of specialized UI elements like MultiPage, TabStrip, SpinButton, and Image controls.
Clipboard Interaction: The MSForms.DataObject is a powerful tool for sophisticated clipboard handling beyond simple text, allowing you to manage data formats more precisely.
Rich Collections: The library organizes elements into logical structures like the Controls, Pages, and Tabs collections, making it easier to programmatically iterate through complex UI layouts.
Bidirectional Support: Controls can exhibit right-to-left characteristics, which is essential for developing localized applications for certain languages. How to Add the Library to Your Project
To use these features, you must explicitly reference the library in your development environment: Open your VB6 or VBA project. Go to Tools → References.
Locate and check the box for Microsoft Forms 2.0 Object Library. microsoft forms 20 object library vb6
If it is not listed, use the Browse button to find FM20.DLL in your system folder (typically found in System32 or SysWOW64). Crucial Redistribution and Licensing Warnings
Before you start building, there are critical legal and technical "gotchas" to keep in mind: Collections, controls, and objects (Microsoft Forms)
Microsoft Forms 2.0 Object Library ) is a legacy component primarily used in VBA but occasionally referenced in Visual Basic 6.0 (VB6) to access enhanced UI features like Unicode support multi-column list boxes Spiceworks Community Core Features of the Library
While designed for VBA UserForms, it provides several advantages over standard VB6 controls: Unicode Compatibility
: Unlike standard VB6 controls, which are mostly ANSI-based, Forms 2.0 controls can display Unicode characters, making them useful for internationalization. Multi-Column Controls : It includes
controls that natively support multiple columns without complex API calls. Right-to-Left (RTL) Support : Controls exhibit bidirectional characteristics when the RightToLeft
property is enabled, aiding in localization for RTL languages. Advanced UI Elements : Access to controls like the objects, as well as a specialized DataObject for handling clipboard operations. How to Add the Library in VB6 Open your VB6 project. Navigate to Project > References Microsoft Forms 2.0 Object Library in the list and check the box. If not listed and navigate to C:\Windows\System32\FM20.DLL on 64-bit systems). Google Groups Critical Limitations & Risks Unlocking the Microsoft Forms 2
Developers should be cautious when using this library in compiled VB6 applications:
Add object libraries to your Visual Basic project - Microsoft Support
The library is part of the Microsoft Office suite. Its primary purpose is to power UserForms in VBA (Excel, Word, Access). However, because it’s a COM-based ActiveX control library, any COM-aware environment—including VB6—can instantiate and use its objects.
The main components you get access to are:
Image control.When you add a reference to Microsoft Forms 2.0 Object Library in VB6 (via Project → References), you gain access to several powerful objects and controls, including:
CommandButtonTextBoxMultiPageTabStripCheckBoxOptionButtonListBoxComboBoxImageSpinButtonScrollBarLabelDifferent versions of Office install different FM20 versions. Design your project on the minimum version you expect users to have. Usually, FM20.DLL version 2.0 (from Office 97/2000) is safest for broad compatibility.
While the library includes many controls, let’s focus on the most valuable ones for VB6 developers. MultiPage : A tabbed dialog control without needing
Change event fires more frequently than in VB6 native controls.Me.Refresh or subclassing to mitigate.The Microsoft Forms 2.0 Object Library (FM20.dll) provides form controls that can be used outside of Microsoft Office applications, directly in VB6 applications. These controls offer more advanced features than standard VB6 controls.
You cannot directly drag an MSForms UserForm from the toolbox. Instead, you must instantiate it programmatically:
Dim myForm As MSForms.UserForm Set myForm = New MSForms.UserForm myForm.Caption = "Hello from MSForms" myForm.Width = 300 myForm.Height = 200' Add a control Dim btn As MSForms.CommandButton Set btn = myForm.Controls.Add("MSForms.CommandButton") btn.Caption = "Click Me" btn.Left = 100 btn.Top = 80
myForm.Show
Alternatively, you can create a UserControl or Designer class that hosts MSForms controls at runtime.