It is likely that your VBA project will need a custom form. For example, you might provide the operator with a choice of options before your program executes some task, like importing data. Or you might want to provide the operator with a custom data entry dialog box.
In VBA, you build these forms yourself. These forms are just like the dialog boxes you've seen or used in Windows, such as the logon dialog box shown when you start up. The only difference is that you get to choose how these dialogs appear, when they appear, and what they do.
To learn more about Visual Basic forms, refer to the Help topics within the sections Microsoft Forms Design Reference, Microsoft Forms Developer's Tips, and Microsoft Forms Object Model Reference of the Visual Basic for Applications Help file, or search for the Index keyword "forms".
One concept that you should keep in mind when launching forms from DeltaV Operate is the idea of modal and modeless forms. A form is modal if it does not allow you to work with its host application while it is being displayed. Conversely, if a form is modeless it allows you to work with its host application even while it is displayed.
If you launch a modal form from a VBA script within DeltaV Operate, users must respond to the form before they can continue working with the DeltaV Operate environment (which includes selecting menus, toolbars, objects in a picture, and so forth). No subsequent code is executed until the form is hidden or unloaded. When a form is modeless, all subsequent code is executed as it is encountered.
WARNING!Never try to unload a form from within the same form, or from any control within the form. Instead, call the Hide method from within the form, and unload it from the main routine once it is hidden.
Modeless forms do not appear in the task bar and are not in the window tab order. To call a modeless form, use the following code:
userForm1.Show vbModeless
You may lose data associated with a modeless UserForm if you make a change to the UserForm project that causes it to recompile, for example, removing a code module.
When using a modeless form, if you do not want to allow the user to get to DeltaV Operate, use the DeActivateWorkspaceUI which essentially disables the DeltaV Operate UI. For more information, see the DeActivateWorkspaceUI Method topic in the Automation Interfaces Help.
Inserting an Alarm Summary object into a VBA form may cause unpredictable results when opening the picture or switching environments from run-time to configuration or vice versa.