Forms
Build UserForms visually and attach event code.
The form designer builds real UserForms. Not imitations of dialogs, but what Excel itself writes: the form appears in the VBE, opens there and can be edited further.
Drawing
Pick a control on the left and it lands on the surface. Dragging moves it, the handle at the bottom right resizes it, and both snap to six points. Arrow keys nudge by one grid step, with Shift by four. Delete removes.
Available: label, text box, combo box, list box, check box, option button, toggle button and command button.
Below the palette, On the form lists every control; a click selects it. Whatever you cannot see on the canvas is marked there: hidden (entirely underneath another one and not clickable on the canvas – select it here and move it with the arrow keys), empty (a label without text) and outside (beyond the form's edge).
To copy a whole form, use the copy button next to its name in the list. The
copy is called <Name>_2, gets new ids and keeps the control names and the
code. Where the code uses the form's name instead of Me, it still points at
the original.
Units
Everything is in points, the same unit the properties window in the VBA editor shows. Open the form there later and you read the same numbers the designer showed.
A control hanging over the edge is a warning, not an error: Excel draws the form anyway, you just cannot see that control. The properties panel then names the size the form would need, and a button sets it.
Code behind a control
Click a control, pick an event, write VBA. The procedure it becomes is printed above the editor:
Private Sub CommandButton1_Click()
MsgBox TextBox1.Text
End Sub
You write the body only; the generator adds the signature. Other controls are
addressed directly, TextBox1.Text works with no plumbing.
Which events are offered depends on the type. A label has no Change.
The properties are laid out compactly like the VBE properties window and collapse via their heading. The code takes the rest of the column; Expand opens it in a wide window, Esc closes it again.
The export only puts Option Explicit into the form module when you write the
line at the top of the form code yourself.
Names
A control's name becomes a VBA identifier, and the event procedure is named after it. So it has to be unique within the form, and the form name must not clash with a module name: both live in the same namespace, even though they look unrelated in the editor.
Opening the form
A form does not show itself. Add a ribbon button and attach:
Sub OpenForm()
UserForm1.Show
End Sub
One form for several buttons
When several buttons need the same inputs but each does something different afterwards – say six queries where only one or two captions change – one form is enough. On the ribbon button under Actions, choose Open a form and set:
- Form and, optionally, a window title for this button.
- Captions for this button: one field per label. Empty keeps the form's text.
- OK button: after its Click code the form counts as confirmed and closes.
An
Exit Subin your checks keeps it open – exactly what a failed check should do. Do not put anUnloadthere, or the inputs are gone before the procedure gets them; validation warns about it. - Then call: the procedure that does the actual work. It receives the values of the input fields in tab order. The editor shows the call and the matching signature:
Public Sub ExportFloc(ByVal v_Anlage As String, ByVal v_NOT As String, ByVal v_COC As String)
' the actual query
End Sub
Cancel or the window's X end the button without an error. The procedure belongs in a module and does not know the form – that way it can be called and tested without it.
Dry run
Under the actions, Dry run starts a pass in the browser: the generated code
on the left, F8 steps line by line like in the VBE. At .Show the form
appears the way this button opens it – changed captions get a dashed outline –
and its fields can be filled in. After OK the log shows which procedure
would be called with which values; after Cancel the run jumps to
Cancelled:.
Nothing is executed. The dry run shows the flow addin.studio generates itself; your own code – checks in the Click code, the body of the procedure – only runs in Excel.
Dialogs
Forms › Dialogs builds styled messages and questions that appear instead
of MsgBox: a symbol in a coloured circle, title, text, a coloured main
button and, if you like, a second one. Dialogs are in every plan, without
a line of code; the Free plan includes one.
Press + to pick one of ten templates – confirm delete, overwrite file, success, error and others – or start blank. Everything can be changed afterwards: kind and symbol, colour, texts, buttons. The preview shows the dialog the way Excel draws it.
Borderless (the default) hides the title bar and rounds the corners; the window is dragged by its empty area. On the Mac a normal window appears instead. Enter picks the main button, Esc cancels.
Placeholders
A word in curly braces in the text becomes a placeholder, {customer} for
example. The property panel gives it a default that applies when the call
passes none.
Calling a dialog
Without code: on a ribbon button, choose the action Show own dialog. If the user picks the second button, the following steps stop.
In your own VBA every dialog is a function that returns True for the main
button:
If modDialoge.ConfirmDelete("Invoice 2024-117") Then
' delete
End If
Dialogs with a single button always return True.
What is missing
Frames and multi-page controls, the containers, do not exist yet. Neither do tab strip, scroll bar, spin button and image. RefEdit cannot be generated at all; it is an Excel control, not an MSForms one.