-
Hello all,
I know that it is possible to go through every control on a form, like this:
Dim objControl As Control
Dim intCounter As Integer
For Each objControl in Form1.Controls
objControls.Caption = "Control" & intCounter
inCounter = intCounter + 1
Next
What about going through the Forms in a project?
This doesn't work though:
Dim aform As Form
For Each aform In ProjectName
If aform.Name <> "Form1" Then
aform.Enabled = False
End If
Next
Is there a way to go through forms in a project like going through controls on a form?
Thanks
Sunny L.
-
<?>
Code:
'address all forms in a project
Public Sub UnloadAllForms()
Dim Form As Form
For Each Form In Forms
Unload Form
Set Form = Nothing
Next Form
End Sub
-
This will make all Forms (except Form1) invisible.
Code:
Dim Frm As Form
For Each Frm In Forms
'If the Name is not Form1 then make it invisible
If Frm.Name <> "Form1" Then Frm.Visible = False
Next Frm