3

I insert some frames (microsoft forms 2.0 frame) into the excel sheet. And I wish i could click one then bring it to front of all other frames. but it is not working. with the belowing code. frame1 still under the frame2,3,4... msobringtofront works well on normal inserted shapes, but not with the frame

Private Sub Frame1_Click()
ActiveSheet.Shapes("frame1").ZOrder msoBringtofront
End Sub
zhangjie25
  • 75
  • 5

2 Answers2

4

Try this

Sub Sample()
    Dim oleObj As OLEObject

    Set oleObj = ActiveSheet.OLEObjects("frame1")

    oleObj.BringToFront
End Sub

enter image description here

Siddharth Rout
  • 147,039
  • 17
  • 206
  • 250
-1

ZOrder method: Frame1.ZOrder (fmTop)

BatMan
  • 1