UI Functions

Functions that interact with the user interface or the operating system.


MsgBox

MsgBox(Message, [Style], [Title])

Displays a modal message box and returns the button the user clicked.

Parameter Description
Message The message text to display
Style (optional) Combination of button and icon style constants (see below)
Title (optional) Window title text

Style constants (combine with or / +):

Constant Description
vbOkOnly OK button only (default)
vbOkCancel OK and Cancel buttons
vbYesNo Yes and No buttons
vbYesNoCancel Yes, No, and Cancel buttons
vbAbortRetryIgnore Abort, Retry, and Ignore buttons
vbRetryCancel Retry and Cancel buttons
vbCritical Error icon
vbExclamation Warning icon
vbInformation Information icon
vbQuestion Question icon

Returns: MsgBoxResult

Return constant Value
vbOk User clicked OK
vbCancel User clicked Cancel
vbYes User clicked Yes
vbNo User clicked No
vbAbort User clicked Abort
vbRetry User clicked Retry
vbIgnore User clicked Ignore

Examples:

MsgBox("Operation complete.")
MsgBox("Delete this record?", vbYesNo or vbQuestion, "Confirm")

Dim result = MsgBox("Continue?", vbOkCancel)
If result = vbOk Then
  ' proceed
End If

InputBox

InputBox(Text, [Title], [Default Value])

Displays a dialog with a text input field. Returns the text entered by the user, or an empty string if the user cancels.

Parameter Description
Text Prompt text displayed above the input field
Title (optional) Window title
Default Value (optional) Pre-filled value in the input field

Returns: String

Examples:

Dim name = InputBox("Enter your name:")
Dim qty = InputBox("Enter quantity:", "Order Entry", "1")

Start

Start(Path, [Arguments])

Launches an external program or opens a file using the system's default handler.

Parameter Description
Path Path to the executable or file to open
Arguments (optional) Command-line arguments to pass

Returns: Boolean (True on success)

Examples:

Start("notepad.exe")
Start("C:\Reports\report.pdf")
Start("C:\Tools\process.exe", "/silent /input=data.csv")

GetTotalMemory

GetTotalMemory([ForceFullCollection])

Returns the total number of bytes currently allocated in managed memory. Optionally forces a full garbage collection before reporting.

Parameter Description
ForceFullCollection (optional) If True, forces a GC before measuring. Default False.

Returns: Long (bytes)

Examples:

Dim mem = GetTotalMemory()
Dim mem2 = GetTotalMemory(True)    ' force GC first
MsgBox("Memory used: " & mem & " bytes")