The following example shows how to change the caption of a Customers form to a value supplied by the user. The ChangeCaption subroutine passes the Me property (representing the Form object) to specify the active form. Because the ChangeCaption procedure changes the caption of the active form (not a specific form), it can be called from other procedures in an application.
ChangeCaption Me, InputBox("Enter new caption "
& "for form")
Sub ChangeCaption(frmCurrentForm As _
Form, strCaption As String)
' Change caption.
If TypeName(frmCurrentForm.Caption) = "Null" Then
frmCurrentForm.Caption = strCaption
Exit Sub
End If
If UCase(strCaption) _
<> UCase(frmCurrentForm.Caption) Then
frmCurrentForm.Caption = strCaption
End If
End Sub