I have taken this code from Access and trying to use it in Excel to lock all the TextBox, ComboBox & CheckBox on the form.
In Access this works fine but trying it Excel it tells me variable not defined and highlights the acTextBox as the problem.Dim ctlControl As Control For Each ctlControl In usrfrmReport.Controls If ctlControl.ControlType = acTextBox Or _ ctlControl.ControlType = acComboBox Or _ ctlControl.ControlType = acCheckBox Then ctlControl.Enabled = False End If Next
How can I get around this as otherwise I have to code every single control and this would make my code enormous?
Bookmarks