hindersaliva
asked on
Excel 2016 VBA - userform and z-Order of controls
I have a UserForm and 2 controls. When the form opens I want the ComboBox to be in front of the Label. I can't see where I can set this at design time. Can it be set at design time?
But, I put this in the Initialize
Me.Label1.ZOrder (0)
Me.ComboBox1.ZOrder (1)
Swapping the (0) and the (1) has no effect!
But the ComboBox is behind the Label. However, when I click on the ComboBox it becomes visible in front of the Label. This is odd.
How can I make the ComboBox appear in front all the time?
Thanks. File attached.
EE-question-on-ZOrder.xlsm
But, I put this in the Initialize
Me.Label1.ZOrder (0)
Me.ComboBox1.ZOrder (1)
Swapping the (0) and the (1) has no effect!
But the ComboBox is behind the Label. However, when I click on the ComboBox it becomes visible in front of the Label. This is odd.
How can I make the ComboBox appear in front all the time?
Thanks. File attached.
EE-question-on-ZOrder.xlsm
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Roy, the idea is, when a Checkbox is clicked the ComboBox appears positioned over where a Label is positioned. When the ComboBox selection is made it disappears and the Label takes the value of the selected item. There are 14 of these on the form. It avoids having 14 ComboBoxes with the same items.
I'm surprised that the Z-Order cannot be set at design time. (If that's so)
I'm surprised that the Z-Order cannot be set at design time. (If that's so)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Martin, the same happens.
When I click the checkbox nothing visible happens. But when I move the UserForm the combobox appears.
It looks like the combobox appears only when the screen needs to draw itself (redraw).
When I click the checkbox nothing visible happens. But when I move the UserForm the combobox appears.
It looks like the combobox appears only when the screen needs to draw itself (redraw).
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Crystal, I solved it by making the Label.Visible = False and turning it back again when the ComboBox is made Visible = False.
It is important for me that the ComboBox and the Label are in the same position with the same dimensions.
Thanks for your suggestion.
It is important for me that the ComboBox and the Label are in the same position with the same dimensions.
Thanks for your suggestion.
You're welcome. Glad you got it! Since you only posted a generic sample, naturally I could not detect your business logic.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Pleased to help
To turn on the Properties, press F4 or choose: View, Properties Window from the menu
You can get the combobox to be on top by cutting it and pasting it back. The newest control is on top.