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

sleep°ÝÃD¡H

sleep°ÝÃD¡H

¥»©«³Ì«á¥Ñ joey0415 ©ó 2012-8-15 15:57 ½s¿è

¥H«e¦bµ{¦¡«e®a¤W
'«Å§iwin api¨ç¼Æ
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)


¤§¥Îµ{¦¡¨Ó½Õ¥Î¥¦³£¨S¦³°ÝÃD

²{¦b¦]¬°ª@¯Å¦¨win7 64¦ì¤¸¡Aoffice 2010¤]¬O64¦ì¤¸«á¡A¥´¶}Àɮ׫á´N·|¦³°ÝÃD



¤£ª¾¹D«ç»ò­×§ï©O¡H

ÁÂÁÂ

¦^´_ 1# joey0415
¸Õ¸Õ¬Ý¡I
®t§O¦b©ó Long ¤Î LongLong ªº«Å§i«¬ºA¡C
  1. #If VBA7 And Win64 Then
  2.        ' 64 bit Excel
  3.        Public Declare Sub Sleep Lib "kernel32" ( _
  4.            ByVal dwMilliseconds As LongLong)
  5. #Else
  6.       ' 32 bit Excel
  7.      Public Declare Sub Sleep Lib "kernel32" ( _
  8.          ByVal dwMilliseconds As Long)
  9. #End If

  10. Sub Test()
  11.       Sleep NumberOfSeconds * 1000
  12. End Sub
½Æ»s¥N½X

TOP

¦^´_  joey0415
¸Õ¸Õ¬Ý¡I
®t§O¦b©ó Long ¤Î LongLong ªº«Å§i«¬ºA¡C
c_c_lai µoªí©ó 2012-8-15 21:20


·PÁ¤j¤jªº¦^À³¡A¤£¹LÁÙ¬O¦³¨Ç¿ù»~¡A½Ð°Ý«ç»ò­×§ï©O¡H

TOP

¦^´_ 3# joey0415
§Ú¨S¦³64¦ì¤¸¨t²ÎµLªk´ú¸Õ¡A±z¥i°Ñ¦Ò¤U¦C³sµ²§Þ³N¤å³¹
http://msdn.microsoft.com/zh-tw/ ... erfaceCompatibility
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Hsieh
¦^´_ 3# joey0415
­ì¨Ó¦p¦¹¡A ¨ü±Ð¤F¡I Âà­z¦p¤U¡G
  1. Declare Function RegOpenKeyA Lib "advapi32.dll" (ByVal Key As Long, ByVal SubKey As String, NewKey As Long) As Long
½Æ»s¥N½X
¦b Microsoft Visual C ©M Microsoft Visual C++ ¤¤¡A«e¤@½d¨Ò·|¦P®É¥¿½T¦a½sĶ 32 ¦ì¤¸©M 64 ¦ì¤¸¡C³o¬O¦]¬° HKEY ·|©w¸q¬°«ü¼Ð¡A
¨ä¤j¤p¤Ï¬Mµ{¦¡½X½sĶ©Ò¦b¤§¥­¥xªº°O¾ÐÅé¤j¤p¡C
¦bª© VBA ¤¤¡A¨Ã¨S¦³¯S©wªº«ü¼Ð¸ê®ÆÃþ«¬¡A¦]¦¹·|¨Ï¥Î Long ¸ê®ÆÃþ«¬¡C¦¹¥~¡A¥Ñ©ó Long ¸ê®ÆÃþ«¬¤@«ß¬° 32 ¦ì¤¸¡A
¦]¦¹¦b¨ã¦³ 64 ¦ì¤¸°O¾ÐÅ骺¨t²Î¤W¨Ï¥Î®É¡A·|¦]¬°ºIÂ_¤W¤è 32 ¦ì¤¸©Î½Æ¼g¨ä¥L°O¾ÐÅé¦ì§}¦Ó·l·´¡C
³o¨Ç±¡ªp·|¾É­PµLªk¹w´Áªº¦æ¬°©Î¨t²Î·í¾÷¡C
¬°¤F¸Ñ¨M³o­Ó°ÝÃD¡AVBA ²{¦b¥]§t¥¿½Tªº¡u«ü¼Ð¡v¸ê®ÆÃþ«¬¡GLongPtr¡C¦¹·s¸ê®ÆÃþ«¬¥iÅý±z¥¿½T¦a¼g¤J­ì©l Declare ³¯­z¦¡¡A¦p¤U©Ò¥Ü¡G
  1. Declare PtrSafe Function RegOpenKeyA Lib ¡§advapire32.dll¡¨ (ByVal hKey as LongPtr, ByVal lpSubKey As String, phkResult As LongPtr) As Long
½Æ»s¥N½X
¦¹¸ê®ÆÃþ«¬©M·sªº PtrSafe ÄÝ©Ê¥iÅý±z¦b 32 ¦ì¤¸©Î 64 ¦ì¤¸¨t²Î¤W¨Ï¥Î¦¹ Declare ³¯­z¦¡¡C
PtrSafe ÄÝ©Ê·|¦V VBA ½sĶ¾¹«ü¥Ü Declare ³¯­z¦¡¬O°w¹ï 64 ¦ì¤¸ª©¥»ªº Office 2010¡C¦pªG¨S¦³¦¹ÄÝ©Ê¡A
¦b 64 ¦ì¤¸¨t²Î¤¤¨Ï¥Î Declare ³¯­z¦¡·|¾É­P½sĶ®É´Á¿ù»~¡C½Ðª`·N¡APtrSafe Äݩʦb 32 ¦ì¤¸ª©¥»ªº Office 2010 ¤W¬°¿ï¥Î¡C
³oÅý²{¦³ªº Declare ³¯­z¦¡¥i¦p©¹±`¯ë¹B§@¡C

TOP

¦^´_ 5# c_c_lai

¦n¹³¦³¦n¤@ÂI¡I¤£¹Lµe­±·|¥X²{¤U­±¦p¹Ï

============================
---------------------------
Microsoft Visual Basic for Applications
---------------------------
½sĶ¿ù»~:

¨S¦³©w¸q³o­Ó Sub ©Î Function
===============================

TOP

¥»©«³Ì«á¥Ñ joey0415 ©ó 2012-8-16 16:29 ½s¿è

§ä¨ì¤èªk¤F¡I32»P64¦ì¤¸³£¥i¥H¥Îªº®@¡I
  1. '«Å§iwin api¨ç¼Æ  , ¥H¤U¤èªk¬O64»P32¦ì¤¸³£¥i¥H¥Îªº¤è¦¡®@¡I
  2. 'Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

  3. [code]'«Å§iwin api¨ç¼Æ  , ¥H¤U¤èªk¬O64»P32¦ì¤¸³£¥i¥H¥Îªº¤è¦¡®@¡I
  4. 'Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

  5. #If VBA7 Then
  6. Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
  7. #Else
  8. Private Declare Sub Sleep Lib "kernel32" (ByVal ms as Long)
  9. #End If
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ­×¦æ­nô½t­×¤ß¡AÂǨƽm¤ß¡AÀH³B¾i¤ß¡C
ªð¦^¦Cªí ¤W¤@¥DÃD