148btx
Thành viên mới
- Tham gia
- 14/10/06
- Bài viết
- 40
- Được thích
- 103
- Nghề nghiệp
- Thiết kế điện
Tôi muốn làm cái CommandBarControl cho công việc riêng nhưng loay hoay chưa biết làm thêm mấy cái FaceId cho đẹp. Bạn nào biết xin chỉ giúp.
Cảm ơn, sau đây là đoạn Code:
Cảm ơn, sau đây là đoạn Code:
PHP:
Public ntwin As Boolean
Sub DeleteCWizElectricMenuItem()
Dim cbpop As CommandBarControl
Set cbpop = Application.CommandBars( "Worksheet menu bar"). _
FindControl(Type:=msoControlPopup, Tag:="CWizElectricMenu")
If Not cbpop Is Nothing Then cbpop.Delete
End Sub
Sub CreateCWizElectricMenuItem()
Dim cbpop As CommandBarControl
Dim cbctl As CommandBarControl
Dim cbsub As CommandBarControl
Dim Wkb As String
' Check for custom menu. If it exists then exit. '
Set cbpop = Application.CommandBars( "Worksheet menu bar"). _
FindControl(Type:=msoControlPopup, Tag:="CWizElectricMenu")
If Not cbpop Is Nothing Then Exit Sub
' Create a popup control on the main menu bar '
Set cbpop = Application.CommandBars("Worksheet Menu Bar"). _
Controls.Add(Type:=msoControlPopup)
cbpop.Caption = "CircuitWi&z"
cbpop.Visible = True
' Set tag property to find it later for deletion'
cbpop.Tag = "CWizElectricMenu"
' Add a menu item '
Set cbctl = cbpop.Controls.Add(Type:=msoControlButton)
cbctl.Visible = True
'Assign short cut to key '
Application.OnKey "%1", "CWizFormatBook"
' Next is required for caption '
cbctl.Style = msoButtonCaption
cbctl.Caption = "&New Schematic Workbook Alt+1"
' Action to perform '
cbctl.OnAction = "CWizFormatBook"
' Add a menu item'
Set cbctl = cbpop.Controls.Add(Type:=msoControlButton)
cbctl.Visible = True
'Assign short cut to key '
Application.OnKey "%2", "CWizFormatSheet"
' Next is required for caption '
cbctl.Style = msoButtonCaption
cbctl.Caption = "&New Schematic Worksheet Alt+2"
' Action to perform '
cbctl.OnAction = "CWizFormatSheet"
' Add a menu item '
Set cbctl = cbpop.Controls.Add(Type:=msoControlButton)
cbctl.Visible = True
'Assign short cut to key '
Application.OnKey "%3", "eSymbolsIECform"
' Next is required for caption '
cbctl.Style = msoButtonCaption
cbctl.Caption = "&IEC Symbols Alt+3"
' Action to perform '
cbctl.OnAction = "eSymbolsIECform"
End Sub
Chỉnh sửa lần cuối bởi điều hành viên: