A VBIDE add-in that converts VBA UserForms for use in twinBASIC.
The twinBASIC (in Beta) does not yet support VBA UserForms. It does however have its own excellent VB6-compatible native Form designer and associated controls. This simple VBIDE add-in for MS Office applications converts a UserForm, its controls, images, and code into a twinBASIC form that can be imported directly into twinBASIC.
This tool, compiled in twinBASIC, queries the state of the UserForm and each of its child controls at design time and builds the closest twinBASIC equivalent. For non-MS Forms controls or MS Forms controls not supported (see below), a twinBASIC Label or Frame control is substituted to flag the missing control. UserForm code is translated and exported in a format that can be imported into twinBASIC, along with the form.
The resulting imported form and code may have to be tweaked in twinBASIC to work as desired, but at least the position and most property states will be converted, saving time and tedious effort.
MS Forms controls supported: Label, TextBox, CommandButton, Frame, CheckBox, ComboBox, ListBox, OptionButton, Image, ScrollBar, ToggleButton, and SpinButton.
MS Forms controls not yet supported: TabStrip, and MultiPage.
Extract Image Resources Option: User can optionally extract and save to file all image resources (mouse icons and picture bitmaps) that are embedded in each UserForm for later use in twinBASIC Resources.
Example: Comparison of VBA UserForm (left) and converted twinBASIC form with VisualStyles=False (right)
- 64-bit MS Windows
- MS Office 2010 or later, 32/64-bit
- Make sure to close all MS Office applications.
- Download and run the tBUserformConverterSetup.exe Inno installer.
- Open an MS Office document that contains UserForm(s) to be converted.
- Open the Visual Basic for Application IDE.
- You should see the "twinBASIC Tools" menu item on the far right of the main menu bar.
- If menu not visible, then click on "Add-ins->Add-in Manager".
- In Add-in Manager window, click on tbUserFormConverter Add-in, and then make sure "Loaded/Unloaded" is checked - this will toggle on the "twinBASIC Tools" menu item.
- Click on "twinBASIC Tools" menu, then "Convert UserForm".
- In the dialog that pops up, select the UserForm(s) that you want to convert, and then hit Convert button.
- You will be prompted where to save the processed twinBASIC files - there should be two resulting files per UserForm - a .tbform and a .twin file.
- Import the twinBASIC files into twinBASIC IDE (Project->Add->Import File(s)…).
Add-in Manager: You can change the load behavoir of the Add-in by clicking Add-ins->Add-in Manager
VBIDE Menu: After install, the twinBasic Tools menu item should show on the right side of the VBA menu.
Convert Dialog: The UserForm Converter dialog allows to select the UserForm(s) for conversion.
- Wayne Phillips' twinBASIC and Sample 4: MyVBEAddin
- Tim Hall's JsonConverter
- Jon Johnson's Windows Development Lib twinBASIC package
- R. Beltran's ArrayList twinBASIC package
- Jordan Russell's Inno Setup and Bill Stewart's UninsIS