Tạo thêm tùy chọn cho menu mới

Liên hệ QC

NH_DK

Let's patience
Tham gia
29/7/10
Bài viết
865
Được thích
1,203
Nghề nghiệp
Kế toán
Chào cả nhà! Em đang muốn tạo thêm 1 menu mới có tùy chọn. Câu hỏi cụ thể trong file đính kèm!
 

File đính kèm

  • bai hoi GPE.rar
    109.1 KB · Đọc: 32
Chào cả nhà! Em đang muốn tạo thêm 1 menu mới có tùy chọn. Câu hỏi cụ thể trong file đính kèm!

Đã có 1 cái Popup rồi, giờ viết thêm cái nữa cũng y vậy thôi
Code trong UserForm
PHP:
Private Sub BuiltPopup1()
  Dim cBar As CommandBar
  On Error Resume Next
  Set cBar = CommandBars("ufPopup1")
  If cBar Is Nothing Then
    With CommandBars.Add("ufPopup1", 5)
      With .Controls.Add(1)
        .Caption = "Cong viec 1"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Cong viec 2"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Cong viec 3"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Thoat"
        .OnAction = "dong"
      End With
    End With
  End If
End Sub
PHP:
Private Sub BuiltPopup2()
  Dim cBar As CommandBar
  On Error Resume Next
  Set cBar = CommandBars("ufPopup2")
  If cBar Is Nothing Then
    With CommandBars.Add("ufPopup2", 5)
      With .Controls.Add(1)
        .Caption = "Cong viec 4"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Cong viec 5"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Cong viec 6"
        '.OnAction = "thu tuc"
      End With
      With .Controls.Add(1)
        .Caption = "Thoat"
        .OnAction = "dong"
      End With
    End With
  End If
End Sub
PHP:
Private Sub Label1_Click()
  CommandBars("ufPopup1").ShowPopup
End Sub
PHP:
Private Sub Label2_Click()
  CommandBars("ufPopup2").ShowPopup
End Sub
PHP:
Private Sub UserForm_Initialize()
  On Error Resume Next
  BuiltPopup1
  BuiltPopup2
End Sub
PHP:
Private Sub UserForm_Terminate()
  On Error Resume Next
  CommandBars("ufPopup1").Delete
  CommandBars("ufPopup2").Delete
End Sub
 
Upvote 0
Vâng, thế là ổn rùi ah. Nhưng cho em hỏi thêm 1 câu hỏi nữa nhé: Giờ em muốn tạo menu con (menu cấp 2) thì phải viết code thế nào?
 
Upvote 0
Upvote 0
Web KT
Back
Top Bottom