I
Ian
Using Word 97.
Before allowing a user to close a form, I want to check that none of the
boxes on the form are empty, using syntax something like:
~~~~~~~~~~~~~~~~
With MyForm
If .MyComboBox1.Value = "" then
MsgBox "Error: Box 1 is undefined"
End With
~~~~~~~~~~~~~~~~
This is fine for one or two boxes, but for many boxes it would be better
to create a subroutine to do the job, and pass the name of the box (e.g.
".MyComboBox1") and the corresponding variable error text (e.g. "Box 1")
as parameters to it.
Question is: How do I pass ".MyComboBox1" as a parameter to a
subroutine, so that I can dynamically build the object
".MyComboBox1.Value"?
Before allowing a user to close a form, I want to check that none of the
boxes on the form are empty, using syntax something like:
~~~~~~~~~~~~~~~~
With MyForm
If .MyComboBox1.Value = "" then
MsgBox "Error: Box 1 is undefined"
End With
~~~~~~~~~~~~~~~~
This is fine for one or two boxes, but for many boxes it would be better
to create a subroutine to do the job, and pass the name of the box (e.g.
".MyComboBox1") and the corresponding variable error text (e.g. "Box 1")
as parameters to it.
Question is: How do I pass ".MyComboBox1" as a parameter to a
subroutine, so that I can dynamically build the object
".MyComboBox1.Value"?