1. This is why I answered "yes", with no further information. I could not, as no further information was given.
2. Skip suggests using Visible...and not to disparage Skip (who would dare????), but it it is exactly the same thing as #1 above. Not enough information. Skip is making his suggestion based on an
assumption, NOT information.
The Visible property does not exist for checkboxes in a document. Neither formfield checkboxes (using the Forms toolbar), nor ActiveX checkboxes (using the Controls toolbar) have a Visible property.
Checkboxes on a
userform have a Visible property - thus, Skip made an assumption that you are asking about checkboxes on a userform. It is that "form" word. It is - unfortunately - very badly used in communication. Be VERY careful, and very explicit!, when using the word "form".
I suspect - but agreed, I do not not know...which is, again, why I simply answered "Yes" - that you are using formfield checkboxes
in the document.
And, again, the answer to "Is this possible?" is Yes. However, much better, accurate details on your requirements, and precisely what you wish to do, including precise logic, are required.
Also, a clear understanding of WHY you wish to do this, but the answer is a Yes. A qualified Yes.
Qualified? Yes qualified, because, as there is no Visible property, work-arounds (and there are a few) can do things like make a checkbox Height and Width = 1, thus essentially making it...invisible. I have done this. This option will ONLY work for ActiveX controls (checkboxes). This option will NOT work for formfield checkboxes.
And....just to belabor the point...you have not stated what kind of checkboxes you are using....
Nor have you clearly stated your logic requirements. For example, if the user goes back and changes the selection from the combobox - and do you mean dropdown???? - is it a requirement that the checkboxes go away? You do not say.
Other work-arounds can be making text (the paragraph containing the checkbox) Hidden. That works but is IMO sloppy. Other options can be to dynamically delete/recreate the checkboxes depending on the logic.
So...again. "Is this possible?"
Yes.
Here is an
very simple (logically speaking) example.
Code:
If ActiveDocument.FormFields("Colours").Result = " red " Then
CheckBox1.Height = 18.5
CheckBox1.Width = 108
CheckBox2.Height = 18.5
CheckBox2.Width = 108
Else
CheckBox1.Height = 1
CheckBox1.Width = 1
CheckBox2.Height = 1
CheckBox2.Width = 1
End If
There is a
formfield DropDown named "Colours". In my test it has " blue ", " black ", " green " and " red ", as the dropdown items.
Note the spaces in the item strings.
The code executes when you exit the Colours formfield, using the OnExit macro.
If " red " is the Result (i.e. red is selected from the dropdown), THEN 2
ActiveX checkboxes (Checkbox1, and Checkbox2 - use better names!!!!) are resized to 18.5 in Height, and 108 in Width, thus...becoming "visible".
ELSE (i.e red is NOT selected)
THEN the checkboxes are explicitly set to 1 in both Height and Width, essentially becoming invisible.
The above uses both formfields (the dropdown) and ActiveX controls (the checkboxes), but it could use ActiveX for all of them.
If your checkboxes are formfields, the above will NOT work, as you can not dynamically resize them.
There are, again, other possibilities - so the answer IS....Yes, but you would have to give real details of what you have, and what you want to happen.
faq219-2884
Gerry
My paintings and sculpture