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

[µo°Ý] DDE°O¿ý¸ê®Æ¨D§U

¦^´_ 25# n8975067
  1. Option Explicit
  2. Dim timerEnabled As Boolean    ' §P©w¶}±Ò¥»¤u§@ªí³æªº®É¬q¬O§_¬°¶}½L«e±Ò°Ê¡C

  3. Private Sub Workbook_Open()
  4.     timerEnabled = False
  5.      
  6.     Call timerStart            ' µ{¦¡¤@±Ò©l¡A«K¥h¦Û°Ê°õ¦æ timerStart
  7. End Sub

  8. Private Sub Workbook_BeforeClose(Cancel As Boolean)
  9.     On Error Resume Next
  10.     Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkbook.RTimer", , False
  11.    
  12.     Me.Save
  13. End Sub

  14. Sub timerStart()   
  15.     If timerEnabled Then
  16.         ' ²Ä¤G¦¸(§t)¥H«á§¡¥H³]©w¤§ "¶¡¹j®É¬q" ¨Ó³B²z°õ¦æ§Çªº§@·~¡C
  17.         Application.OnTime (Now + TimeValue("00:05:00")), "ThisWorkbook.updateFollow"    '  ¨C¹j¤­¤ÀÄÁ°õ¦æ¤@¦¸
  18.     Else
  19.         timerEnabled = True
  20.         
  21.         ' ±N²Ä¤@¦¸±Ò°Ê®É¶¡§ó§ï¬°³]©w "¶}½L®É¶¡"«e¡A¦pªG¶}±Ò Excel ®É¡A¤w¸g¹L¤F³]©w "¶}½L®É¶¡"¡A«h¤@¶i¤J¨t²Î§Yª½±µ¥h°õ¦æ¬ö¿ý§@·~¡C
  22.         If (TimeValue(Now) <= TimeValue("08:45:00")) Then
  23.             Application.OnTime (TimeValue("08:45:00")), "ThisWorkbook.updateFollow"
  24.         Else
  25.             ' ¨t²Î­è³s¤W DDE ¦Ü¸ê®Æ¶×¤JExcel¤u§@ªí³æ¡A¶·¦³¤@­Ó½w½Ä®É¬q¡A
  26.             ' ³o®É¦pªG°¨¤W¥h§ì¨úDDE¸ê®Æ¡A·|¦³«¬ºA¤£²Åªº¿ù»~°T®§²£¥Í¡A¨Ã¤¤Â_°õ¦æ§Çªº§@·~¡C
  27.             Application.OnTime (Now + TimeValue("00:00:05")), "ThisWorkbook.updateFollow"
  28.         End If
  29.     End If
  30. End Sub

  31. Sub updateFollow()
  32.     Dim Rng As Range
  33.    
  34.     On Error Resume Next
  35.     If (TimeValue(Now) < TimeValue("08:45:00") Or TimeValue(Now) > TimeValue("13:45:00")) Then Exit Sub

  36.     With Sheet2
  37.         '  Set Rng = .Range("A" & .Range("A" & .Rows.Count).End(xlUp).Row + 1)
  38.         '
  39.         '  Rng = Sheet1.[c2]
  40.         '  Rng.Offset(, 1) = Sheet1.[d2]
  41.         '  Rng.Offset(, 2) = Sheet1.[e2]
  42.         '  Rng.Offset(, 3) = Sheet1.[f2]
  43.         '  Rng.Offset(, 4) = Sheet1.[g2]
  44.         '  Rng.Offset(, 5) = Sheet1.[h2]
  45.         '  Rng.Offset(, 6) = Sheet1.[i2]
  46.         '  Rng.Offset(, 7) = Sheet1.[j2]
  47.         '  Rng.Offset(, 8) = Sheet1.[k2]
  48.         '  Rng.Offset(, 9) = Sheet1.[l2]
  49.         '  ¤W­±¤§±Ô­zªí¹F»P¤U¦Cªº±Ô­zµ²ªG¬O¤@¼Ëªº¡A®t²§¥u¦b©ó¨Ï¥Î»yªk¤§¥©§®¤£¦P¡C
  50.         Set Rng = .Range("A" & .Range("A" & .Rows.Count).End(xlUp).Row + 1).Resize(1, 10)
  51.         
  52.         Rng(1) = Sheet1.[c2]
  53.         Rng(2) = Sheet1.[d2]
  54.         Rng(3) = Sheet1.[e2]
  55.         Rng(4) = Sheet1.[f2]
  56.         Rng(5) = Sheet1.[g2]
  57.         Rng(6) = Sheet1.[h2]
  58.         Rng(7) = Sheet1.[i2]
  59.         Rng(8) = Sheet1.[j2]
  60.         Rng(9) = Sheet1.[k2]
  61.         Rng(10) = Sheet1.[l2]
  62.     End With
  63.    
  64.     If timerEnabled Then Call timerStart
  65. End Sub
½Æ»s¥N½X
§Ú§â§Aªº updateFollow() »P§Aªº»Ý¨D¡A¥þ³¡¾ã¦X¦b¤@°_¡A
½Ð±N¥¦¥þ³¡Âл\©ó ThisWorkbook µ{¦¡½X½s¿è°Ï¶ô¤º¡C
¨C¤é 08:45:00 ¥H«e¶}±Ò¥¦ ¡A 08:45:00®É¶¡¤@¨ì¡A¨t²Î«K·|¦Û°Ê±Ò°Ê°õ¦æ¡A
13:45:00¤@¶W¹L®É¶¡¡Aµ{¦¡«K·|¦Û°Ê°±¤î¤£¦A°õ¦æ¡C
«ö¶s§A¥i¥H«O¯d¡A¦pªG¨t²Î©ó¬ðµoª¬ªp¤U°±¤î¹B§@¡A
§A¥i¥HÂI¿ï«ö¶s«ì´_¨t²Î¹B§@¡C

TOP

¦^´_ 24# c_c_lai
c_c_¤j¡A§Ú¦³§ä¨ì¤@½g½d¨Ò
http://forum.twbts.com/viewthrea ... a=pageD9&page=3
¨º§Ú¬O§_¯à±N¶}½L¦¬½L¨º¦æ²¾´Ó¹L¨Ó´N¥i¥H¨Ï¥Î?

TOP

¦^´_ 22# n8975067
¦pªG§A·Q­n¨t²Î¦Û°Ê±±ºÞ¶}½L¡B»PÃö½L¡A
¨º»ò§A«K­n°Ñ¦Ò¨ä¥L½d¨Ò¤F¡I

TOP

¦^´_  c_c_lai
³ø§ic_c_¤j¡A¤µ¤Ñ¸Õ¥Î¡A¤w¸g¥i¥H°O¿ý¤F¡A¦ý¬O§_¬O­n«ö«ö¶s¤~·|±Ò°Ê?
¥t¥~§Ú·Q­n¦b¦­¤W084 ...
n8975067 µoªí©ó 2013-4-25 14:47

¦]¬°§Ú­n´ú¸Õ§A©Ò»¡ªº°ÝÃDÄpµ²¡A¬°¸`¬Ù´ú¸Õ®É¶¡¡A
©Ò¥H§Ú¥H¨C¹j¤@¤ÀÄÁ¤@¦¸¡A¨ÓÆ[¹î°õ¦æµ²ªG¤§¬G¡C
«ö¶s¤§¥Î·N¡A¬O¦b©ó·í§A­n¶}©l°õ¦æ®É¤è«K§A±Ò¥Î¡A
¦Ó¤£¶·¦A¨ìµ{¦¡°Ï±Ò°Êµ{¦¡¡C
¦p¦¹»¡©ú¥i¥H¶Ü¡H

TOP

¦^´_ 21# c_c_lai
³ø§ic_c_¤j¡A¤µ¤Ñ¸Õ¥Î¡A¤w¸g¥i¥H°O¿ý¤F¡A¦ý¬O§_¬O­n«ö«ö¶s¤~·|±Ò°Ê?
¥t¥~§Ú·Q­n¦b¦­¤W0845®É¡A¨C¹j¾ã¼Æ5¤ÀÄÁ¶}©l°O¿ý(¨Ò¦p0850 0900)¡A§Ú¦³¬Ý¨ì±zªº¥t¤@½g¤å³¹¡A¤W­±¦³´£¨ì¤èªk¡A¬O·Ó¨º¤W­±ªº»yªk¶Ü?



PS:¤j¤j¡A¦³­Ó¦a¤è§Ú¤£¤Ó¤F¸Ñ¡A¬°¦ó·|¦³¤­¤ÀÄÁ¸ò¤@¤ÀÄÁªº©I¥s©O?

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-4-24 04:36 ½s¿è

¦^´_ 20# n8975067
  1. Sub updateFollow()
  2.     Dim Rng As Range
  3.    
  4.     With Sheet2
  5.         '  Set Rng = .Range("A" & .Range("A" & .Rows.Count).End(xlUp).Row + 1)
  6.         '
  7.         '  Rng = Sheet1.[c2]
  8.         '  Rng.Offset(, 1) = Sheet1.[d2]
  9.         '  Rng.Offset(, 2) = Sheet1.[e2]
  10.         '  Rng.Offset(, 3) = Sheet1.[f2]
  11.         '  Rng.Offset(, 4) = Sheet1.[g2]
  12.         '  Rng.Offset(, 5) = Sheet1.[h2]
  13.         '  Rng.Offset(, 6) = Sheet1.[i2]
  14.         '  Rng.Offset(, 7) = Sheet1.[j2]
  15.         '  Rng.Offset(, 8) = Sheet1.[k2]
  16.         '  Rng.Offset(, 9) = Sheet1.[l2]
  17.         '  ¤W­±¤§±Ô­zªí¹F»P¤U¦Cªº±Ô­zµ²ªG¬O¤@¼Ëªº¡A®t²§¥u¦b©ó¨Ï¥Î»yªk¤§¥©§®¤£¦P¡C
  18.         Set Rng = .Range("A" & .Range("A" & .Rows.Count).End(xlUp).Row + 1).Resize(1, 10)
  19.         
  20.         Rng(1) = Sheet1.[c2]
  21.         Rng(2) = Sheet1.[d2]
  22.         Rng(3) = Sheet1.[e2]
  23.         Rng(4) = Sheet1.[f2]
  24.         Rng(5) = Sheet1.[g2]
  25.         Rng(6) = Sheet1.[h2]
  26.         Rng(7) = Sheet1.[i2]
  27.         Rng(8) = Sheet1.[j2]
  28.         Rng(9) = Sheet1.[k2]
  29.         Rng(10) = Sheet1.[l2]
  30.     End With
  31.    
  32.     '  Application.OnTime Now + 60 / 86400#, "ThisWorkbook.updateFollow"    '  ¨C¤@¤ÀÄÁ©I¥s ¤@¦¸
  33.     Application.OnTime Now + 300 / 86400#, "ThisWorkbook.updateFollow"      '  ¨C¤­¤ÀÄÁ©I¥s ¤@¦¸
  34. End Sub
½Æ»s¥N½X
¤w¶Çµ¹§A¤F¡I
¦b Sheet1 ¥[¤W¤F±Ò°Ê«ö¶s¡A¤è«K§A°õ¦æ¬d®Ö¡C

TOP

¦^´_ 19# c_c_lai
[email protected]

TOP

¦^´_  c_c_lai
c_c_¤j

§Ú¬O©ñ¸m©óThisWorkbook ¨S¿ù
n8975067 µoªí©ó 2013-4-23 08:36

§A E-Mail µ¹§Ú¡A§Ú§âÀɮ׶ǵ¹§A¡C

TOP

¦^´_ 17# c_c_lai
c_c_¤j

§Ú¬O©ñ¸m©óThisWorkbook ¨S¿ù

TOP

¦^´_  c_c_lai
"ThisWorkbook.updateFollow"
³o¤@¥y
n8975067 µoªí©ó 2013-4-22 21:40

¾ã¬qµ{¦¡½XÀ³©ñ¸m©ó ThisWorkbook ¤º¡A¦pªG©ñ¸m©ó¼Ò²Õ¤º¡A
§A«K­n¥h­×¥¿ ThisWorkbook.updateFollow ¬° Modulex.updateFollow¡C

TOP

        ÀR«ä¦Û¦b : °µ¦n¨Æ¤£¯à¤Ö§Ú¤@¤H¡A°µÃa¨Æ¤£¯à¦h§Ú¤@¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD