Image Behind button

Mat

Well-known Member
Joined
Sep 17, 2003
Messages
509
Hi,

I have a userform with 2 buttons and an image, and some other stuff not important for my problem.

The first button show the image :

Private Sub cbSchema_Click()
frmFAQ.Height = 250
cbRetour.Visible = True
imgSchema.Visible = True
End Sub

And the second buttons hide the image :

Private Sub cbRetour_Click()
frmFAQ.Height = 188.25
imgSchema.Visible = False
cbRetour.Visible = False
End Sub


Well my button cbRetour is supposed to be OVER the image, but now it is behind, so the user can't use it to go back...

How can I specify the order of the control?

Thank you
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
You can use the ZOrder property of the control.

e.g. I set up a userform with an Image named "Image1" and two commandbuttons, "CommandButton1" and "CommandButton2"

This is the code I put in each of the commandbuttons, I think this is what you wat:

Code:
Private Sub CommandButton2_Click()
  CommandButton2.ZOrder 1
  Image1.ZOrder 0
  CommandButton1.ZOrder 0
End Sub


Private Sub CommandButton1_Click()
  CommandButton2.ZOrder 0
  Image1.ZOrder 1
  CommandButton1.ZOrder 1
End Sub

If this isn't exactly what you need, just repost.
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top