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

[µo°Ý] Excel VBE commandBar control ID ½Xªº¦Cªí

[µo°Ý] Excel VBE commandBar control ID ½Xªº¦Cªí

¨Ò¦p¹ïVBEªº¾Þ§@Á`­n¦³ ID¦p¤U¡G
Application.VBE.CommandBar().findcontrol(ID:= controlID,)

¤£ª¾­þ¦ì¤j®v¦³³o­Óªí¥i¥H¤À¨É ¡AÁÂÁÂ

¦^´_ 6# GBKEE


    ÁÂÁÂ GBKEE ¤j®v

TOP

¦^´_ 5# Scott090
½Ð°õ¦æ 2#ªºµ{¦¡


·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 4# GBKEE


    ÁÂÁÂ GBKEE ¤j®v
§Ú´«­Ó¤è¦¡¡G
.findcontrol(ID:=1561). excecute ¥i¥H¦b 2010°õ¦æ, ¨ú¥X¤Þ¥Î references µ¡Åé
¥u¬O³o­Ó¸¹½X 1561 ¦b ID ¦Cªí¤º§ä¤£¨ì

·P®¦

TOP

¦^´_ 3# Scott090
FindControl(ID:=1561).execute  1561§ä¤£¨ì,·|¬O2010ªºID¤£¦P??
³oID¬OÀ³¥Îµ{¦¡¦Û¦æ«Ø¥ßªº½s½X.

(§Ú¥Î2003)

  1. Option Explicit
  2. Sub CommandBar_ID()
  3.     Dim C As CommandBar, W As CommandBarControl, E As CommandBarControl, xl_Id As Integer
  4.     On Error Resume Next
  5.     For Each C In Application.CommandBars
  6.         For Each W In C.Controls
  7.             For Each E In W.Controls
  8.                 If E.Caption Like "À˵øµ{¦¡½X*" Then xl_Id = E.ID
  9.             Next
  10.         Next
  11.     Next
  12.     ³]©w¤Þ¥Î¶µ¥Ø xl_Id
  13. End Sub
  14. Private Sub ³]©w¤Þ¥Î¶µ¥Ø(Bar_ID)  '¿òº|¶µ¦s¦b®É¥Î¤â°Ê§R°£,¥Î¤â°Ê¦sÀÉ«á­«·s°õ¦æµ{¦¡.
  15.     Dim E
  16.     On Error Resume Next
  17.     With ThisWorkbook.VBProject
  18.         For Each E In .References
  19.          Debug.Print E.Name
  20.         Next
  21.     End With
  22.     If Err <> 0 Then
  23.        Application.CommandBars.FindControl(ID:=Bar_ID).Execute
  24.        Application.SendKeys "%T"
  25.        Application.SendKeys "R"
  26.       End
  27.     End If
  28. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE

ÁÂÁ ¤j®v¡A¤w¨Ì·Ó«üÂI°õ¦æ¡F
¥H¤UªºVBA½X¬O¤j®v´¿¸g«üÂIªº¡A¥Î¨ÓÅã¥Ü Referencesµ¡Å骺¡A ¨ä¤¤ªº ...  .FindControl(ID:=1561).execute  1561§ä¤£¨ì¡F
¥t¡Aª¦¤å¤¤¤]¦³¥Î ID:=2578 ¨Ó¥s¥Î VBProject ±M®×±K½Xµ¡Åé¡A³o­Ó 2578 ¤]¦b¦Cªí¤¤§ä¤£¨ì

´±°Ý¤j®v ³o¨ÇID¬O«ç»ò¨Óªº
·q½Ð«üÂI
·P®¦

    Private Sub ³]©w¤Þ¥Î¶µ¥Ø()  '¿òº|¶µ¦s¦b®É¥Î¤â°Ê§R°£,¥Î¤â°Ê¦sÀÉ«á­«·s°õ¦æµ{¦¡.
    Dim E
    On Error Resume Next
    With ThisWorkbook.VBProject
        For Each E In .References
         Debug.Print E.Name
        Next
    End With
    If Err <> 0 Then
       Application.CommandBars.FindControl(ID:=1561).Execute
       Application.SendKeys "%T"
       Application.SendKeys "R"
      End
    End If
End Sub

TOP

¦^´_ 1# Scott090
  1. Option Explicit
  2. Sub CommandBar_Id()
  3.     Dim C As CommandBar, W As CommandBarControl, E As CommandBarControl, I As Integer
  4.     On Error Resume Next
  5.     For Each C In Application.CommandBars
  6.         For Each W In C.Controls
  7.             For Each E In W.Controls
  8.                 Cells(I, "A") = E.Caption
  9.                 Cells(I, "B") = E.ID
  10.                 I = I + 1
  11.             Next
  12.         Next
  13.     Next
  14. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¯à·F¤£·F¡A¤£¦p­W·F¹ê·F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD