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

½Ð°Ý¦p¦ó¥ÎÁä½LÁä¸òCommandButton¦³¬Û¦P¥\¯à

½Ð°Ý¦p¦ó¥ÎÁä½LÁä¸òCommandButton¦³¬Û¦P¥\¯à

¥»©«³Ì«á¥Ñ cdkee ©ó 2010-10-6 18:00 ½s¿è

Public i As Integer

Private Sub CommandButton1_Click()

i = i + 1
        Sheets("sheet1").Cells(i, 1) = "X="
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)

End Sub

½Ð±Ð¤j¤j¡A«öÁä½LÁä(¨Ò¦p"F1")¸ò«öCommandButton1¦³¬Û¦P¥\¯à¡A¬O«ç¼Ë¼g¦¨ªº?ÁÂÁÂ!

Public i As Integer

Private Sub CommandButton1_Click()

Application.OnKey "{F1}"
i = i + 1
        Sheets("sheet1").Cells(i, 1) = "X="
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)

End Sub

¸Õ¤F³o­Ó¡A¦ý¤£¦¨¥\...

TOP

Private Sub CommandButton1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
§ä¨ì³o­Ó¡A¦ý¤£À´¦³¨S¦³Ãö«Y...

TOP

Public i As Integer
Private Sub CommandButton1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = Asc("{F1}") Then
CommandButton1_Click
End If
End Sub


Private Sub CommandButton1_Click()
i = i + 1

        Sheets("sheet1").Cells(i, 1) = "X="
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)

End Sub
¸Õ¤F³o­Ó¡A¤]¤£¦¨¥\...

TOP

¦^´_ 2# cdkee
¥²¥ý°õ¦æ¤U­±µ{¦¡
Sub Ex()
Application.OnKey "{F1}", "Sheet1.CommandButton1_Click"
End Sub

TOP

¦^´_ 5# GBKEE


    Public i As Integer
Sub Ex()
Application.OnKey "{F1}", "Sheet1.CommandButton1_Click"
End Sub

Private Sub CommandButton1_Click()

i = i + 1

        Sheets("sheet1").Cells(i, 1) = "X="
        Sheets("sheet1").Cells(i, 2) = Int((10 * Rnd) + 1)

End Sub
ÁÂÁª©¤j!¦ýÁÙ¬O¤£¦¨...¤p½úÁÙ¦³¤°»ò¿ù?

TOP

¦^´_ 6# cdkee
Sub Ex()
Application.OnKey "{F1}", "Sheet1.CommandButton1_Click"
End Sub

Private Sub CommandButton1_Click()  -> ¬OSheet1 ªº¨p¥Îµ{§Ç¶Ü?  <- Sheet1 ­n­×§ï¶Ü?

TOP

³o­n¥ÎAPIªºHook(¹_¤l¨ç¼Æ)¨ÓºÊµø§AªºÁä½L¾Þ§@¡A¤ñ¸û³Â·Ð¡A«Ü¦h¤ì°¨´N¨Ï¥Î¤F³o­Ó§Þ³N¨Ó±o¨ì§A¿é¤Jªº±K½X¡B±b¸¹µ¥¸ê°T¡C
§A¦b¿ý»s¥¨¶°®É¡A·|¤¹³\§A³]¸m¤@­Ó¡§§Ö±¶Á䡨¡A³q¹L³o­Ó§Ö±¶Áä¨Ó¹B¦æ§»¥N½X¡A¤]¥i¥H±o¨ì¦P¼Ëªº¥Øªº¡C

TOP

¦^´_  cdkee
Sub Ex()
Application.OnKey "{F1}", "Sheet1.CommandButton1_Click"
End Sub

Private  ...
GBKEE µoªí©ó 2010-10-6 21:15



    Sheet1¬O¨p¥Îµ{§Ç¡A­n­×§ï¨º¨Ç?ÁÂÁª©¤j!
³o­n¥ÎAPIªºHook(¹_¤l¨ç¼Æ)¨ÓºÊµø§AªºÁä½L¾Þ§@¡A¤ñ¸û³Â·Ð¡A«Ü¦h¤ì°¨´N¨Ï¥Î¤F³o­Ó§Þ³N¨Ó±o¨ì§A¿é¤Jªº±K½X¡B±b ...
et5323 µoªí©ó 2010-10-6 21:26

¤j¤j¬O»¡¨S¦³API´N¤£¦æ?

TOP

1. In design mode, select your CommandButton1;
2. In the Properties window, enter a single letter for the field Accelerator;

Suppose the caption of your CommandButton1 is ¡§Fire¡¨ and a letter ¡§r¡¨ is typed in step 2, then letter ¡§r¡¨ will be underlined.
Other letters will be accepted but the underline will not shown in the caption.
Also note that it is different for lower and upper case letters.

To run your subroutine, press ALT+r or click CommandButton1 for the above example.
§ä¨ì¹³¼Ëªº¡A¦ý­n«ö2­ÓKEY¡A¤ÎFUNCTION KEY¤£¯à§Q¥Î!
½Ð±Ð¤j¤j«ç¼Ë§ï¡A¤]¥i·|°µ¨ì?

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD