For Each x In Me.Controls
If x.GroupName = "Test" Then
MsgBox "Found it"
End If
Next x
... I get a Type mismatch on the For Each line. Any idea why?
Select Case True
Case SizeA0.Value
Print #FileNumber, "0"
Case SizeA1.Value
Print #FileNumber, "1"
Case SizeA2.Value
Print #FileNumber, "2"
Case SizeA3.Value
Print #FileNumber, "3"
Case SizeA4.Value
Print #FileNumber, "4"
End Select
OK, I would make a couple of changes. In your Proceed_Click, I would change the IF-ElseIf s to a Select CaseCode: [Select]Select Case True
Case SizeA0.Value
Print #FileNumber, "0"
Case SizeA1.Value
Print #FileNumber, "1"
Case SizeA2.Value
Print #FileNumber, "2"
Case SizeA3.Value
Print #FileNumber, "3"
Case SizeA4.Value
Print #FileNumber, "4"
End Select
This is easier to follow than nested IF statements. Select will eval each "Case" until it finds one that is true.
I would do the same for the Length ElseIfs
Another change I made was to Group all the Size buttons together in one GroupName and group the Lengths as well under another name. (see picture). This will allow the SizeA2_Click code you have to work (Which I changed to the new group names)
As this was simplified, I couldn't test fully, but it should get you going
Private Sub disablelength()
LengthS.Enabled = False
LengthP.Enabled = False
Length03.Enabled = False
Length05.Enabled = False
Length06.Enabled = False
Length07.Enabled = False
Length08.Enabled = False
Length09.Enabled = False
Length10.Enabled = False
LengthA0.Enabled = False
LengthA1.Enabled = False
LengthA2.Enabled = False
End Sub
Private Sub SizeA2_Click()
disablelength
LengthA2.Enabled = True
Me.ListBox1.List() = Array("Standard", "Portrait", "A2 (594 mm)", "03 (630 mm)")
Proceed.SetFocus
End Sub
Looks like I'm late to the party. :-)Hey Matt I for one am glad for your continued time support in the swamp...