엑셀/vba

userform 팝업메뉴 만들기

do121 2023. 2. 24. 19:06

Private Sub cmd_popupmenu_Click()


Dim ctrl0, ctrl1, ctrl2, ctrl3
    
    Application.ScreenUpdating = False
    On Error Resume Next
    Application.CommandBars("iMenu").Delete
    Set ctrl0 = Application.CommandBars.Add(Name:="iMenu", Position:=msoBarPopup)


                Set ctrl1 = ctrl0.Controls.Add(1)
                With ctrl1
                    .Caption = "인쇄"
                    .FaceId = 31
                    .OnAction = "print"

                End With

                Set ctrl2 = ctrl0.Controls.Add(1)
                With ctrl2
                    .Caption = "자리바꾸기"
                    .FaceId = 32
                    .OnAction = "change"
                End With

                Set ctrl3 = ctrl0.Controls.Add(1)
                With ctrl3
                    .Caption = "시트복사"
                    .FaceId = 33
                    .OnAction = "copysht"
                End With



    Application.ScreenUpdating = True
    ctrl0.ShowPopup
    

End Sub

'엑셀 > vba' 카테고리의 다른 글

잔액 구하기 chatgpt  (0) 2023.04.06
userform 팝업메뉴 2 chatgpt  (0) 2023.03.17
시트 이동 chatgpt  (0) 2023.02.23
두셀의 값을 바꾸기 chatgpt  (0) 2023.02.23
통합문서 합치기 chatgpt  (0) 2023.02.22