GRCNC
08-24-2016, 11:40 AM
Hi - I'm a novice to VBA with Microsoft Word and am having trouble working with ComboBoxes and would like some help. I have a document with six ComboBoxes. The first ComboBox (Combobox1) is a drop down (1-5). The other ComboBoxes are named cb_LOC1, cb_LOC2, cb_LOC3, cb_LOC4, and cb_LOC5. Whatever number is selected, I'd like to "show" that number of ComboBoxes and "hide" the rest. My code is below and I'm receiving an error (Compile error: invalid qualifier) at the "i" in cb_LOC& i. FYI: I'm using Width and Height b/c I can't find the "Visible" property.
Does anyone have any suggestions as to what I'm doing wrong.
Finally, not sure if the code below is going to come over in code tags or not. I read the rules and it indicates there should be a "VBA" button up top, but I don't see it. Apologies in advance...
Dim cb As ComboBox
Dim i As Long
For i = ComboBox1.Value + 1 To 5
cb_LOC& i.Width = 1
cb_LOC& i.Height = 1
next i
Does anyone have any suggestions as to what I'm doing wrong.
Finally, not sure if the code below is going to come over in code tags or not. I read the rules and it indicates there should be a "VBA" button up top, but I don't see it. Apologies in advance...
Dim cb As ComboBox
Dim i As Long
For i = ComboBox1.Value + 1 To 5
cb_LOC& i.Width = 1
cb_LOC& i.Height = 1
next i