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

[µo°Ý] onaction="Macro",macro¦³°Ñ¼Æ¦p¦ó¼g§r

¦^´_ 1# mhl9mhl9

¬O­n°ÝCommandBarButton.OnAction ªº³¡¤À¶Ü¡H

TOP

¦^´_ 5# mhl9mhl9

°Ñ¦Ò¬Ý¬Ý
  1. Public Const B1 As String = "text-B1"
  2. Public Const B2 As String = "text-B2"
  3. Public Const B3 As String = "text-B3"

  4. Public Sub abc()
  5.     With Application.CommandBars.Add("´ú¸Õ", msoBarTop, , True)
  6.         .Visible = True
  7.         With .Controls.Add(Type:=msoControlPopup) '°Ñ¼Æ¥N¤J¼Æ¦r
  8.             .Caption = "´ú¸Õ1"
  9.             With .Controls.Add(Type:=msoControlButton)
  10.                 .Caption = "´ú¸Õ0"
  11.                 .OnAction = "text" '¨S¥N¤J°Ñ¼Æ
  12.             End With
  13.             With .Controls.Add(Type:=msoControlButton)
  14.                 .Caption = "´ú¸Õ1-1"
  15.                 .OnAction = "'text 1'" '¥N¤J°Ñ¼Æ·|¦b­ì¥»³Ì¥~³òªºÂù¤Þ¸¹¸Ì­±¤À§O¥[³æ¤Þ¸¹
  16.             End With
  17.             With .Controls.Add(Type:=msoControlButton)
  18.                 .Caption = "´ú¸Õ1-2"
  19.                 .OnAction = "'text 1,2'" '¤£¦P°Ñ¼Æ¥Î³r¸¹¤À¶}
  20.             End With
  21.             With .Controls.Add(Type:=msoControlButton)
  22.                 .Caption = "´ú¸Õ1-3"
  23.                 .OnAction = "'text 1,2,3'"
  24.             End With
  25.         End With
  26.         With .Controls.Add(Type:=msoControlPopup) '°Ñ¼Æ¥N¤J¤å¦r
  27.             .Caption = "´ú¸Õ2"
  28.             With .Controls.Add(Type:=msoControlButton)
  29.                 .Caption = "´ú¸Õ2-1"
  30.                 .OnAction = "'text ""B1""'" '¤å¦r¥ª¥k°¼¤À§O¥[¤W¨â­ÓÂù¤Þ¸¹
  31.             End With
  32.             With .Controls.Add(Type:=msoControlButton)
  33.                 .Caption = "´ú¸Õ2-2"
  34.                 .OnAction = "'text ""B1"",""B2""'"
  35.             End With
  36.             With .Controls.Add(Type:=msoControlButton)
  37.                 .Caption = "´ú¸Õ2-3"
  38.                 .OnAction = "'text ""B1"",""B2"",""B3""'"
  39.             End With
  40.         End With
  41.         With .Controls.Add(Type:=msoControlPopup) '°Ñ¼Æ¥N¤JÅܼÆ
  42.             .Caption = "´ú¸Õ3"
  43.             With .Controls.Add(Type:=msoControlButton)
  44.                 .Caption = "´ú¸Õ3-1"
  45.                 .OnAction = "'text B1'"
  46.             End With
  47.             With .Controls.Add(Type:=msoControlButton)
  48.                 .Caption = "´ú¸Õ3-2"
  49.                 .OnAction = "'text B1,B2'"
  50.             End With
  51.             With .Controls.Add(Type:=msoControlButton)
  52.                 .Caption = "´ú¸Õ3-3"
  53.                 .OnAction = "'text B1,B2,B3'"
  54.             End With
  55.         End With
  56.     End With
  57. End Sub


  58. Public Sub text(Optional Arg1 = "A1", Optional Arg2 = "A2", Optional Arg3 = "A3")  '¹w³]¨S¥N¤J°Ñ¼Æªº¹w³]­È
  59. MsgBox Arg1 & Chr(10) & Chr(13) & Arg2 & Chr(10) & Chr(13) & Arg3
  60. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : µêªÅ¦³ºÉ¡D§ÚÄ@µL½a¡AµoÄ@®e©ö¦æÄ@Ãø¡C
ªð¦^¦Cªí ¤W¤@¥DÃD