Ãö©ó½L¤¤¶}±ÒDDE¨C¤¤ÀÄÁ§ì¤@¦¸
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
Ãö©ó½L¤¤¶}±ÒDDE¨C¤¤ÀÄÁ§ì¤@¦¸
' DDE ¸ê®Æ¬ö¿ý°ÝÃD
Option Explicit
Dim actEnabled As Boolean
Dim cIndex As Single
Private Sub Workbook_Open()
' ¥H¤U¥|¦C¸ê®Æ¤§³]©w¡A¥i°t¦X¹ê§@¡B©Î´ú¸Õ¤§¥Øªº¡Aª½±µ¦b "sheet1" «ü©w¤§³]©wÄæ¡A±oÀH®É¤©¥H²§°Ê¡C
If (Sheets("sheet1").Range("BA1").Value = "") Then Sheets("sheet1").Range("BA1").Value = "08:45:00" ' °²³]C6Äæ¦ì¬°ªÅ¥Õ¡A«h¼g¤J¶}½L°_©l®É¶¡
If (Sheets("sheet1").Range("BA2").Value = "") Then Sheets("sheet1").Range("BA2").Value = "13:45:59" ' D6Äæ¦ì¥ç¦P¡C(¦¹¨âÄæ¬ö¿ý°_©l²×¤î®É¶¡)
If (Sheets("sheet1").Range("BB1").Value = "") Then Sheets("sheet1").Range("BB1").Value = "00:01:00" ' ¬ö¿ý¸ê®Æ¶×¤J¬Û¹j®É¶¡¡A¦p¨C¹j¤@¤ÀÄÁ¼g¤J¤@¦¸¡C
If (Sheets("sheet1").Range("BB2").Value = "") Then Sheets("sheet1").Range("BB2").Value = 0 ' ¬ö¿ý¤w¶×¤J¸ê®Æ¦C¼Æ¡C
If (TimeValue(Now) > Sheets("sheet1").Range("BA2").Value) Then ' ¦pªG¥Ø«e®É¶¡·~¤w¶W¹L D6 ªºÀç·~®É¬q¡A«h©I¥s.......
Call stopProcedure
Else ' ¤Ï¤§¦b D6 ³]©w®É¶¡¥H«e¡A«h©I¥s.......
Call startProcedure
End If
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Call actStop
End Sub
Sub startProcedure() ' «O¯d§@¬°±±¨î¶µ¤§À³¥Îµ{§Ç¡A¦p«ö¶s¤§¥¨¶°À³¥Îµ¥¡C
Call actStart
End Sub
Sub stopProcedure() ' «O¯d§@¬°±±¨î¶µ¤§À³¥Îµ{§Ç¡A¦p«ö¶s¤§¥¨¶°À³¥Îµ¥¡C
Call actStop
End Sub
Sub newTitle()
Sheets(2).[A1].Resize(, 4) = Sheets(1).[A1:D1].Value ' ®M¤W§A±ý¶×¤J¸ê®ÆªºªíÀY¦WºÙ
End Sub
Sub Starter()
If (actEnabled = True And TimeValue(Now) >= Sheets("sheet1").Range("BA1").Value And TimeValue(Now) <= Sheets("sheet1").Range("BA2").Value) Then
cIndex = Sheets("sheet1").Range("BB2").Value
If (cIndex = 0) Then Call newTitle ' newTitle µ{§Ç (¥Ñ¨Ï¥ÎªÌ¦Û¦æ©w¸q) ¬O±N²Ä¤@¦Cªº¸ê®Æ©ïÀY¦WºÙ¼g¤J¨ìsheet2¡F¦p¤é´Á¡B®É¶¡ªº¹ïÀ³Äæ¦ì¸ê®Æµ¥¡C
Sheets("sheet1").Range("BB2").Value = cIndex + 1 ' ¬ö¿ý¦C¸¹¥[¤@¡C
' ½Æ»s±q¨é°ÓDDE¶×¤J¤§¬Û¹ïÀ³¦ì¸m¸ê®Æ¡A¦p A1¡BB1¡BC1¡BD1 ¹ïÀ³ªº¥i¯à¬O¤º½L¡B¥~½L¡B¦¨¥æ¡Bº¦¶^µ¥µ¥¡A¥H¦¹Ãþ±À¡C
Sheets(2).[A65536].End(xlUp).Offset(1).Resize(, 4) = Sheets(1).[A2:D2].Value
cIndex = Sheets("sheet1").Range("BB2").Value ' ¤Á°O Counter (p¼Æ¾¹) n¥[¤@¡A§_«h¥Ã»·¬°¹s (·íµM¤w¤]¥i¥H¤£¤©¬ö¿ý¸ê®Æ¦Cz¡A¨ÌÓ¤H²ß©Ê)¡C
End If
End Sub
Sub onStarter()
If Not IsError(Sheets(1).[A2]) Then Call Starter
If actEnabled Then Call actStart
End Sub
Sub actStart()
actEnabled = True
Application.OnTime (Now + Sheets("sheet1").Range("BB1").Value), "ThisWorkBook.onStarter" ' ¼g¤J¸ê®Æªº±Æµ{ (¥Ø«e¬O¨C¹j¤¤ÀÄÁ¼g¤J¤@¦¸)
End Sub
Sub actStop()
actEnabled = False
On Error Resume Next
Application.OnTime Now, "ThisWorkBook.onStarter", , False
End Sub
¥Î³o®M¤U¥h×§ï ¦ý¬O½L¤¤¶}±Ò®É§ì¨ú®É¶¡³£¤£¬O ¤¤ÀÄÁKªº®É¶¡ ¨Ò¦p: 11:59:31
½Ð°Ý¸Ó¦p¦óקï Åý¥L¦b ¤¤ÀÄÁ¾ã¤À§ì¨ú |
|
¥æ©ö¤H
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
¦^´_ 10# c_c_lai
·PÁÂC¤j ¥i¥H¤F! |
|
¥æ©ö¤H
|
|
|
|
|
- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 9# 8BQGIGIGAGA
°t¦X§Aªº DDE ¸ê®Æµyµyקï¤F¤@¨Ç¡A¸Õ¸Õ¬Ý§a¡I- ' DDE ¸ê®Æ¬ö¿ý°ÝÃD
- Option Explicit
- Dim actEnabled As Boolean
- Dim i As Single
- Private Sub Workbook_Open()
- ' ¥H¤U¥|¦C¸ê®Æ¤§³]©w¡A¥i°t¦X¹ê§@¡B©Î´ú¸Õ¤§¥Øªº¡Aª½±µ¦b "sheet1" «ü©w¤§³]©wÄæ¡A±oÀH®É¤©¥H²§°Ê¡C
- If (Sheets("sheet1").Range("BA1").Value = "") Then Sheets("sheet1").Range("BA1").Value = "08:45:00" ' °²³]C6Äæ¦ì¬°ªÅ¥Õ¡A«h¼g¤J¶}½L°_©l®É¶¡
- If (Sheets("sheet1").Range("BA2").Value = "") Then Sheets("sheet1").Range("BA2").Value = "13:45:59" ' D6Äæ¦ì¥ç¦P¡C(¦¹¨âÄæ¬ö¿ý°_©l²×¤î®É¶¡)
- If (Sheets("sheet1").Range("BB1").Value = "") Then Sheets("sheet1").Range("BB1").Value = "00:05:00" ' ¬ö¿ý¸ê®Æ¶×¤J¬Û¹j®É¶¡¡A¦p¨C¹j¤@¤ÀÄÁ¼g¤J¤@¦¸¡C
- If (Sheets("sheet1").Range("BB2").Value = "") Then Sheets("sheet1").Range("BB2").Value = 0 ' ¬ö¿ý¤w¶×¤J¸ê®Æ¦C¼Æ¡C
-
- If (TimeValue(Now) > Sheets("sheet1").Range("BA2").Value) Then ' ¦pªG¥Ø«e®É¶¡·~¤w¶W¹L D6 ªºÀç·~®É¬q¡A«h©I¥s.......
- Call stopProcedure
- Else ' ¤Ï¤§¦b D6 ³]©w®É¶¡¥H«e¡A«h©I¥s.......
- Call startProcedure
- End If
- End Sub
-
- Private Sub Workbook_BeforeClose(Cancel As Boolean)
- On Error Resume Next
- Call actStop
- End Sub
-
- Sub startProcedure() ' «O¯d§@¬°±±¨î¶µ¤§À³¥Îµ{§Ç¡A¦p«ö¶s¤§¥¨¶°À³¥Îµ¥¡C
- Call actStart
- End Sub
-
- Sub stopProcedure() ' «O¯d§@¬°±±¨î¶µ¤§À³¥Îµ{§Ç¡A¦p«ö¶s¤§¥¨¶°À³¥Îµ¥¡C
- Call actStop
- End Sub
-
- Sub newTitle()
- Sheets(2).[A1].Resize(, 7) = Sheets(1).[A1:G1].Value ' ®M¤W§A±ý¶×¤J¸ê®ÆªºªíÀY¦WºÙ
- End Sub
-
- Sub Starter()
- Dim cIndex As Single
-
- If (actEnabled = True And TimeValue(Now) >= Sheets("sheet1").Range("BA1").Value And TimeValue(Now) <= Sheets("sheet1").Range("BA2").Value) Then
- cIndex = Sheets(2).[A65536].End(xlUp).Row
-
- If (cIndex = 1) Then Call newTitle ' newTitle µ{§Ç (¥Ñ¨Ï¥ÎªÌ¦Û¦æ©w¸q) ¬O±N²Ä¤@¦Cªº¸ê®Æ©ïÀY¦WºÙ¼g¤J¨ìsheet2¡F¦p¤é´Á¡B®É¶¡ªº¹ïÀ³Äæ¦ì¸ê®Æµ¥¡C
-
- Sheets("sheet1").Range("BB2").Value = cIndex ' ¬ö¿ý¦C¸¹¡C
- ' ½Æ»s±q¨é°ÓDDE¶×¤J¤§¬Û¹ïÀ³¦ì¸m¸ê®Æ¡A¦p A1¡BB1¡BC1¡BD1 ¹ïÀ³ªº¥i¯à¬O¤º½L¡B¥~½L¡B¦¨¥æ¡Bº¦¶^µ¥µ¥¡A¥H¦¹Ãþ±À¡C
- Sheets(2).[A65536].End(xlUp).Offset(1).Resize(, 7) = Sheets(1).[A2:G2].Value
- End If
- End Sub
-
- Sub onStarter()
- Dim nums As Integer
- Dim tmStr As String
-
- tmStr = Format(Sheets("sheet1").Range("BB1").Value, "hh:mm:ss")
- nums = (Left(tmStr, Len(tmStr) - 6) * 3600) + (Mid(tmStr, Len(tmStr) - 4, 2) * 60) + (Right(tmStr, 2) * 1)
- If (IIf(nums >= 60, Minute(TIME) * 60 + Second(TIME), Second(TIME)) Mod nums) = 0 Then ' ¶¡¹j nums ¤À¡B¬í
- If Not IsError(Sheets(1).[C2]) Then Call Starter ' ¦Ò¼{¨C¹j ..¤¤ÀÄÁ°O¿ý¤@¦¸
- If actEnabled Then Call actStart
- Else
- Application.OnTime (Now + TimeValue("00:00:01")), "ThisWorkbook.onStarter"
- End If
- End Sub
- Sub actStart()
- If actEnabled Then
- ' ²Ä¤G¦¸(§t)¥H«á§¡¥H³]©w¤§ "¶¡¹j®É¬q" ¨Ó³B²z°õ¦æ§Çªº§@·~¡C
- Application.OnTime (Now + TimeValue("00:00:01")), "ThisWorkbook.onStarter"
- Else
- actEnabled = True
-
- ' ±N²Ä¤@¦¸±Ò°Ê®É¶¡§ó§ï¬°³]©w "¶}½L®É¶¡"«e¡A¦pªG¶}±Ò Excel ®É¡A¤w¸g¹L¤F³]©w "¶}½L®É¶¡"¡A«h¤@¶i¤J¨t²Î§Yª½±µ¥h°õ¦æ¬ö¿ý§@·~¡C
- If (TimeValue(Now) <= Sheets("sheet1").Range("BA1").Value) Then
- Application.OnTime (TimeValue("08:45:00")), "ThisWorkbook.onStarter"
- Else
- ' ¨t²Îè³s¤W DDE ¦Ü¸ê®Æ¶×¤JExcel¤u§@ªí³æ¡A¶·¦³¤@Ó½w½Ä®É¬q¡A
- ' ³o®É¦pªG°¨¤W¥h§ì¨úDDE¸ê®Æ¡A·|¦³«¬ºA¤£²Åªº¿ù»~°T®§²£¥Í¡A¨Ã¤¤Â_°õ¦æ§Çªº§@·~¡C
- Application.OnTime (Now + TimeValue("00:00:05")), "ThisWorkbook.onStarter"
- End If
- End If
- End Sub
-
- Sub actStop()
- actEnabled = False
-
- On Error Resume Next
- Application.OnTime Now, "ThisWorkBook.onStarter", , False
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
¦^´_ 8# c_c_lai
¥Ñ©ó¤£ª¾¹D«ç»ò¸ÑÄÀ ½Ð¬Ý
Book1.rar (26.16 KB)
|
|
¥æ©ö¤H
|
|
|
|
|
- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ c_c_lai
¤£¬O¨ú¥N쥻ªº¨âÓ sub¶Ü
8BQGIGIGAGA µoªí©ó 2013-1-29 08:58
¨S¿ù¡I
©Ò¦³µ{¦¡½XÀ³¸m©ñ©ó ThisWorkbook ¤º¡A
Private Sub Workbook_Open() ¤~·|¦³©Ò¦^À³¡A
¦pªG§A¨Ï¥Î Private Sub Auto_Open() «Kn©ñ¸m©ó ¼Ò²Õ ¤º¡C
¨º»ò½Ð°Ý§A§âµ{¦¡¥[¨ìþ¸Ì¥h¤F¡H |
|
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
¦^´_ 6# c_c_lai
¤£¬O¨ú¥N쥻ªº¨âÓ sub¶Ü |
|
¥æ©ö¤H
|
|
|
|
|
- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¤j¤j§Ú¥[¶i¥h¥H«áÅܦ¨¤£·|¦s¸ê®Æ¤F@@
8BQGIGIGAGA µoªí©ó 2013-1-28 11:54
§A§âµ{¦¡¥[¨ìþ¸Ì¡H
¦^ÂЮɽпï«ö "¦^´_" ¿ï¯Ã¡A§_«h·í¨Æ¤H¤£ª¾¹D§A¤w¦^´_¡I |
|
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
¤j¤j§Ú¥[¶i¥h¥H«áÅܦ¨¤£·|¦s¸ê®Æ¤F@@ |
|
¥æ©ö¤H
|
|
|
|
|
- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 3# 8BQGIGIGAGA
¸Õ¸Õ¬Ý¡I- Sub onStarter()
- Dim nums As Integer
- Dim tmStr As String
-
- tmStr = Format(Sheets("sheet1").Range("BB1").Value, "hh:mm:ss")
- nums = (Left(tmStr, Len(tmStr) - 6) * 3600) + (Mid(tmStr, Len(tmStr) - 4, 2) * 60) + (Right(tmStr, 2) * 1)
- If (IIf(nums >= 60, Minute(Time)*60+Second(Time), Second(Time)) Mod nums) = 0 Then ' ¶¡¹j nums ¤À¡B¬í
- If Not IsError(Sheets(1).[A2]) Then Call Starter
- If actEnabled Then Call actStart
- Else
- Application.OnTime (Now + TimeValue("00:00:01")), "ThisWorkbook.onStarter" ' ¦Ò¼{¨C¹j .. ¬í°O¿ý¤@¦¸
- End If
- End Sub
- Sub actStart()
- actEnabled = True
-
- Application.OnTime (Now + TimeValue("00:00:01")), "ThisWorkBook.onStarter" ' ¼g¤J¸ê®Æªº±Æµ{ (¥Ø«e¬O¨C¹j¤¤ÀÄÁ¼g¤J¤@¦¸)
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 6
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 12
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office 2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x«n
- µù¥U®É¶¡
- 2013-1-21
- ³Ì«áµn¿ý
- 2013-2-5
|
|
¥æ©ö¤H
|
|
|
|
|