Can Some explain why this code fails
For Each Control In Controls
MyControl = Control.Name: ContName = Left(Control.Name, 4)
If ContName = "VATC" Then
With MyControl
.AddItem "1 - Outside the Scope"
.AddItem "2 - Exempt"
.AddItem "3 - Zero Rated"
.AddItem "4 - Standard Rate (17.5%)"
.AddItem "5 - Reduced Rate (Domestic Fuel etc.)"
.AddItem "6 - Inclusive of VAT at 17.5%"
End With
Else
End If
Next
This cycles through all the Text Boxes etc until it finally finds the first ComboBox "VATC1" (can this route be shortened to look only for Combo Boxes?) it then drops into the With code. MyControl DOES contain the Control Name "VATC1" so that works, but when it tries to run the code ".AddItem "1 - Outside the Scope"", it fails with error message "Run time error 424 - Object Required"
Can someone guid/assist me further please
For Each Control In Controls
MyControl = Control.Name: ContName = Left(Control.Name, 4)
If ContName = "VATC" Then
With MyControl
.AddItem "1 - Outside the Scope"
.AddItem "2 - Exempt"
.AddItem "3 - Zero Rated"
.AddItem "4 - Standard Rate (17.5%)"
.AddItem "5 - Reduced Rate (Domestic Fuel etc.)"
.AddItem "6 - Inclusive of VAT at 17.5%"
End With
Else
End If
Next
This cycles through all the Text Boxes etc until it finally finds the first ComboBox "VATC1" (can this route be shortened to look only for Combo Boxes?) it then drops into the With code. MyControl DOES contain the Control Name "VATC1" so that works, but when it tries to run the code ".AddItem "1 - Outside the Scope"", it fails with error message "Run time error 424 - Object Required"
Can someone guid/assist me further please