I currently have a list of questions that need to be answered by the user completing the drawing and so i have created drop downs for them to select from using the Visio Combo box. I then found a way to format the text box that the question is located in based off of their selection within the combo box. The problem is that i used "case" programming and therefore i have to write scenarios for each of the drop down options. I really only care if the combo box is filled out or not. So basically while the combo box is empty, i want the text box next to it to be filled yellow. Once they select something, anything, then the text box should be filled white or no fill. Here is a sample of the current programming i'm using. i recorded a macro to call the setboxfill that you see below. i searched and search to find a simpler way but to no avail.
Private Sub ComboBox9_Change()
Select Case ComboBox9.Value
Case Is = "GE"
Call SetBoxFill9(255, 255, 255)
Case Is = "DSC"
Call SetBoxFill9(255, 255, 255)
Case Is = "Qolsys"
Call SetBoxFill9(255, 255, 255)
Case Is = "N/A"
Call SetBoxFill9(255, 255, 255)
Case Else
Call SetBoxFill9(255, 255, 0)
End Select
End Sub
You ought to be able to use IF...then...else and use ISEMPTY:
if IsEmpty(ComboBox9.Value) then
set the Color1
else
set the Color2
end if
If that doesn't work, perhaps upload simple Visio file.
So I tried the If IsEmpty and it worked when selecting something from the drop down, it changed the text box to white. However when I cleared the data from the combobox, it did not change the text box fill back to yellow. Seems like maybe i would need to include a "blank" choice in my drop down for it to work although i did not try that. Here is the code i tried:
If IsEmpty(ComboBox2.Value) Then
Call SetBoxFill2(255, 255, 0)
Else
Call SetBoxFill2(255, 255, 255)
End If
Clearing the form probably doesn't reset to empty. The default might be "0" or "0.0000". If you haves window open, you can use f8 to step thru code 1 line at a time. Position mouse cursor over a variable and you'll see its value. You'll have to decide which is more efficient, testing for allowable conditions or not allowable.