zhangjie25
zhangjie25

Reputation: 75

How to bring to front on activex frame

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

Upvotes: 3

Views: 1657

Answers (2)

BatMan
BatMan

Reputation: 1

ZOrder method: Frame1.ZOrder (fmTop)

Upvotes: -1

Siddharth Rout
Siddharth Rout

Reputation: 149287

Try this

Sub Sample()
    Dim oleObj As OLEObject

    Set oleObj = ActiveSheet.OLEObjects("frame1")

    oleObj.BringToFront
End Sub

enter image description here

Upvotes: 4

Related Questions