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

VBA ³]©w¿é¤Jªk(¤¤­^¤åÁä½L)

VBA ³]©w¿é¤Jªk(¤¤­^¤åÁä½L)

½Ð°Ý­þ¦ì¤j¤j«ü¾É¤@¤U
¦p¦ó¦bVBA¤¤³]©wÅܧó¿é¤Jªkªº¤èªk

ÁÂÁÂ¥ý

¦^´_ 1# Scott090


    ¦³¦b¥»½×¾Â§ä¨ìÃþ¦üªº¡A¤£¹L ­n¦b ªí³æ©Î TEXTBOX©ÎÃþ¦ü¦¹ª«¥óªº±¡ªp¤§¤U¡F°ÝÃD¥¼¸Ñ¨M

TOP

½Ð°Ý­þ¦ì¤j¤j«ü¾É¤@¤U
¦p¦ó¦bVBA¤¤³]©wÅܧó¿é¤Jªkªº¤èªk

ÁÂÁÂ¥ý
Scott090 µoªí©ó 2015-4-8 15:47


¥H Windows 8 ¨Ó»¡¥i¥H³o¼Ë¹ê²{ : (XP ³]©w¤è¦¡Ãþ¦ü, ½Ð¦Û¦æ°Ñ·Ó³]©w)

TOP

¦^´_ 3# luhpro


    §Úªº¨t²Î¬O Win8.1  ª`­µ¿é¤Jªk
¤U¹Ï¬°³]©w±¡ªp
  1. '³o­Ó¨C°õ¦æ¤@¦¸´N¥u·|¦Aª¬ºA A»PB ¥æ´«¡A¤£·|¬O¯à³Q´x´¤ªºª¬ºA
  2. Sub KeyBoard()
  3.     SendKeys "^ ", True
  4. '       Application.Wait Now + TimeValue("00:00:02")
  5. End Sub

  6. '³o­Ó¨S¤ÏÀ³
  7. Sub KeyBoard1()
  8.     SendKeys "^+1", True
  9.     Application.Wait Now + TimeValue("00:00:02")
  10. End Sub

  11. '³o­Ó¨S¤ÏÀ³
  12. Sub KeyBoard0()
  13.     SendKeys "%+", True
  14.     Application.Wait Now + TimeValue("00:00:02")
  15. End Sub
½Æ»s¥N½X
¤£ª¾°ÝÃD¦b­þ¸Ì
·q½Ð«ü¾É

TOP

¦^´_ 3# luhpro


    ¸É¥R»¡©ú¡G
#4 ¤º 3 ¬qµ{¦¡³£·|¨Ï ¼Æ¦rÁä½Lªº NumLock ¨Ó¦^ªº Âê©w»PÄÀ©ñ

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2015-4-11 06:52 ½s¿è

Sendkeys ¥¨¶°ªº³¯­z¦¡

§Úªº¨t²Î¬O Win 7 ·f°t Excel 2003 »P Excel 2013 ´ú¸Õ¹L³£¥i¥H¥¿±`¹B§@³á.

¦]¬°§Ú¨S¦³ Win 8,
¤£¯à´ú¸Õ¦bWin 8¤¤³o¨Ç½Æ¦X«öÁ䪺¤ÏÀ³¬O§_¦³®t§O.

³Ì²³æªº½T»{¤è¦¡¬O§A¥i¥H¶} Word:

'³o­Ó¨C°õ¦æ¤@¦¸´N¥u·|¦Aª¬ºA A»PB ¥æ´«¡A¤£·|¬O¯à³Q´x´¤ªºª¬ºA
    SendKeys "^ ", True

¦¹¶µ½Æ¦X«öÁä¬O Ctrl + Space(ªÅ¥ÕÁä) , ¥\¯à¬O¦b ¿é¤J­^¤å¼Ò¦¡ »P ¿é¤J¤¤¤å¼Ò¦¡ ¶¡¨Ó¦^¤Á´«.
¤§«áª½±µ¦bÁä½L¤W«öµÛ Ctrl  Á䤣©ñ,
¦A«ö¤@¤U ªÅ¥Õ Áä,
±µµÛ©ñ±¼ Ctrl Áä,
¬Ý¿é¤Jªk¤Á´«¬O§_¥¿±`,

'³o­Ó¨S¤ÏÀ³
    SendKeys "^+1", True

¦¹¶µ½Æ¦X«öÁä¬O Ctrl + Shift + 1 , ¨Ì§Aªº³]©w¥\¯à¬O¤Á´«¨ì·L³nª`­µ.
©ÎªÌ«öµÛ Ctrl  Áä»P Shift Á䤣©ñ,
¦A«ö¤@¤U 1 «öÁä,(¼Æ¦rÁä«Øij³£¨Ï¥ÎÁä½L¥kÃä¼Æ¦rÁä°Ï¤¤ªº«öÁä, ¥ªÃ䪺¼Æ¦rÁ䦳®É·|¦³¤£¦Pªº·N¸q)
±µµÛ©ñ±¼©Ò¦³«öÁä,
¬Ý¿é¤Jªk¬O§_¦³¤Á´«¨ì·L³nª`­µ,
­Y¨S¤ÏÀ³¥i¯à¬O¨t²Î³]©w»Ý­n¦A°µ½Õ¾ã.

¬Ý¹Ï»¡¬G¨Æ,
¨Ì§AÂ^¨úªºµe­±§Ú²q´ú,
§A¥i¥H¸Õ¸Õ¦b«á­±¨º­Ó  ¶i¶¥³]©wµe­± ¤¤,
¤Á´«¿é¤Jªk ¶µ¤U,
Åý§Ú¬°¨C­ÓÀ³¥Îµ{¦¡µøµ¡...
±N¨º­Ó¥´¤Ä ¨Ã®M¥Î«á¬Ý¬Ý¬O§_¯à¥¿±`¤Á´«.


'³o­Ó¨S¤ÏÀ³
    SendKeys "%+", True

³o­Ó¨S¤ÏÀ³¬O¥¿±`ªº,
%+ ¬O¦P®É«ö¤U Alt »P Shift «öÁä,
¨S¦³·f°t¦P®É«ö¤U¨ä¥L«öÁ䤣À³¸Ó¦³¤ÏÀ³.

¦^´_  luhpro
    ¸É¥R»¡©ú¡G
#4 ¤º 3 ¬qµ{¦¡³£·|¨Ï ¼Æ¦rÁä½Lªº NumLock ¨Ó¦^ªº Âê©w»PÄÀ©ñ
Scott090 µoªí©ó 2015-4-9 14:29

³o¸Ì¬Ý¤£¨ì§A©I¥s KeyBoard ¨º¨Ç°Æµ{¦¡ªº¤è¦¡,
¦pªG©I¥s«e«á¦³°j°é¨º»ò¦³¥i¯à°õ¦æ¼Æ¦¸ KeyBoard °Æµ{¦¡(«öÁä¦n´X¦¸¤F),
³o¤@ÂI¤]¬O»Ý­n½T»{ªº.

¥t¥~³o¤@¦æ:
Application.Wait Now + TimeValue("00:00:02")
¥i¥H³q³q¥Î ' §â¥¦ Mark ±¼,
¦]¬° SendKeys  «á­±©ñ True,
¤w¸g·|µ¥¨ì¿é¤Jª¬ºA¤Á´«§¹²¦¤~·|Ä~Äò°õ¦æ¤U¥h,
¤£»Ý­n¦A°õ¦æµ¥«Ý§@·~.

©ÎªÌ§A¤]¥i¥H¦b §Y®É¹Bºâµøµ¡ ¤¤¿é¤J:
SendKeys "^ ", True
©Î
SendKeys "^+1", True
«á«ö¤U Enter «öÁ䪽±µ°õ¦æ.
¬Ý¿é¤J¼Ò¦¡¬O§_¦³¥¿½T¤Á´«¹L¥h,
­Y³o¸Ì¤£¯à¥¿½T¤Á´«,
¨º©ñ¶i VBA µ{¦¡½X¤¤¤]¤£·|¥¿½T¤Á´«.

TOP

¦^´_ 6# luhpro


    ¨Ì·Ó«ü¾É¡G
1.¤Ä¿ï "... ¬°¨C­ÓÀ³¥Îµ{¦¡µøµ¡³]©w .... "¡A ¸ÕÅçµ²ªG¬O¨S¦³À°§Uªº
2.¨Ï¥Î§Y®É¹Bºâµøµ¡©M ³v¨B°õ¦æ(¤â«ö Enter³v±ø°õ¦æ)¤ù¬qµ{¦¡ªºµ²ªG¬O¤@¼Ëªº¡F
3.ÁöµM Sendkeys ¦³ waitªº°Ñ¼Æ¡A ÁÙ¬OµLªk½T«O¨ä¥¿½T°õ¦æ¡F
4.§Úªº¹q¸£¬O OS Win8.1  ·L³nª`­µ¡A¸g¤ÀªR«á¨äª¬ºA»P¿é¤JÁ䪺Ãö«Y¦p¹Ï

5.¨Ì·Ó¤ÀªRªí§@¤U¦Cµ{¦¡½X
  1. '¨ÏÁä½L¦¨¬° "­^¤å" ¿é¤Jª¬ºA
  2. Sub ChangeIMEToE()
  3.     If IMEStatus = 1 Then
  4.         SendKeys "+", True
  5.     End If
  6. End Sub

  7. '¨ÏÁä½L¦¨¬° "·L³nª`­µ"¿é¤Jª¬ºA
  8. Sub ChangeIMEToC()
  9. '    Call ActiveIMEKeyBoard("·L³nª`­µ")
  10. '    Debug.Print "0,"; IMEStatus

  11. '°²¦pª¬ºA¬O C¡A send a "Shift" key
  12.   If IMEStatus = 2 Then SendKeys "+", True ': Sleep 1500
  13.   DoEvents
  14. '  Debug.Print "1,"; IMEStatus
  15.   
  16.   ''°²¦pª¬ºA¬O B¡A send a "Ctrl Space" keys
  17.   If IMEStatus = 2 Then SendKeys "^ ", True
  18.   DoEvents
  19. '  Debug.Print "2,"; IMEStatus
  20.   
  21.   '°²¦p¤W¤@­Ó Bª¬ºA¤§°_©lª¬ºA¬O C¡A³o®É±oª¬ºA C¡A send a "+" key
  22.   If IMEStatus = 2 Then SendKeys "+", True ': Sleep 500
  23.   DoEvents
  24. '  Debug.Print "3,"; IMEStatus, vbLf

  25. End Sub
½Æ»s¥N½X
¸ÕÅ窺µ²ªG¡G ¥i¥Î
1.Sendkeys ,True ¤£¦¨¥\
2.¥[ Application.wait ...   ¤£¦¨¥\
3. ©I¥s API sleep ...  ¤£¦¨¥\
4. ¥Î DoEvents OK

¥H¤W¬O¹êÅ窺µ²ªG¡A½Ð«ü±Ð

¤]³\´M§ä Win8.1 API ¥i¯à·|¦³§óª½±µªx¥Îªºµª®×

TOP

        ÀR«ä¦Û¦b : ¤â¤ß¦V¤U¬O§U¤H¡A¤â¤ß¦V¤W¬O¨D¤H¡F§U¤H§Ö¼Ö¡A¨D¤Hµh­W¡C
ªð¦^¦Cªí ¤W¤@¥DÃD