ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦b©R¥O¦C¤¤¼W¥[Control«oµLªk§e²{ .Caption ?

[µo°Ý] ¦b©R¥O¦C¤¤¼W¥[Control«oµLªk§e²{ .Caption ?

¥»©«³Ì«á¥Ñ yangjie ©ó 2014-7-14 18:00 ½s¿è

½Ð±Ð¤j¤j¥ý¶i­Ì
¶]§¹¤U¦C »s¥X¤@­ÓCommandBarControl¦b©R¥O¦C¤¤
«oµLªk§e²{ .Caption = "¦^¥D¿ï³æ"
¨D±Ï
Sub MakeMenu1()
    Dim bar As CommandBarControl
    Dim NewMenu1 As CommandBarControl
    Dim MenuCount As Integer
    Dim i As Integer
    For Each bar In Application.CommandBars(1).Controls
          bar.Visible = False
    Next
    On Error Resume Next
          Application.CommandBars(1).Controls("¦^¥D¿ï³æ").Delete
    On Error GoTo 0
    MenuCount = Application.CommandBars(1).Controls.Count
    Set NewMenu1 = Application.CommandBars(1).Controls.Add(Type:=msoControlButton, before:=MenuCount, Temporary:=True)
    With NewMenu1
          .Caption = "¦^¥D¿ï³æ"
          .OnAction = "myForm1"
    End With
End Sub
¿ù»~¦b­þ?
­Y±ý¦A¼W¥[2­ÓControls ¤S¦p¦ó¼W¼g?

¦^´_ 1# yangjie
  1. Option Explicit
  2. Sub MakeMenu1()
  3.     Dim bar As CommandBarControl
  4.     Dim NewMenu1 As CommandBarControl   
  5.     Dim MenuCount As Integer
  6.     Dim i As Integer
  7.     For Each bar In Application.CommandBars(1).Controls
  8.           bar.Visible = False
  9.     Next
  10.     On Error Resume Next
  11.     Application.CommandBars(1).Controls("¦^¥D¿ï³æ").Delete
  12.     On Error GoTo 0
  13.     MenuCount = Application.CommandBars(1).Controls.Count
  14.     Set NewMenu1 = Application.CommandBars(1).Controls.Add(Type:=msoControlPopup, before:=MenuCount, Temporary:=True)
  15.    'Set NewMenu1 = Application.CommandBars(1).Controls.Add(Type:=10, before:=MenuCount, Temporary:=True)
  16.     With NewMenu1
  17.           .Caption = "¦^¥D¿ï³æ"
  18.         '  .OnAction = "myForm1"
  19.          With .Controls.Add(Type:=msoControlButton)
  20.                 .FaceId = 264
  21.                 .Caption = "¦^¥D¿ï³æ A"
  22.              .OnAction = "myForm1"
  23.          End With
  24.          With .Controls.Add(Type:=msoControlButton)
  25.             .FaceId = 207
  26.             .Caption = "¦^¥D¿ï³æ B"
  27.              .OnAction = "myForm1"
  28.          End With
  29.     End With
  30. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE
ÁÂÁÂGBKEEª©¤j
.FaceId = 264
.FaceId = 207
¬O¦ó·N?½Ð«ü¾É

TOP

¦^´_ 3# yangjie
.FaceID=264  §Úª¾¹D¤F
¦ý¦p¦óª¾¹D¨ä¥L¹Ï¥ÜªºID?

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD