- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 11# devidlin
¥i°Ñ¦Ò¤@¤U- 'DDE ¸ê®Æ¬ö¿ý°ÝÃD ¦b'¤@¯ë¼Ò²Õ(Module1)ªºµ{¦¡½X
- Option Explicit
- Dim ¶}½L As Range, ¦¬½L As Range, ¶¡¹j As Range, ¦¸¼Æ As Range, Time_Dee As Date
- '------¦b¤@¯ë¼Ò²Õ(Module1)¤£°_§@¥Îªº----------------
- 'Private Sub Workbook_Open() '¬O ThisWorkbookªºµ{§Ç ¦¹¬¡¶Ã¯Ãö³¬®É ¦Û°Ê°õ¦æªºµ{¦¡
- 'Private Sub Workbook_BeforeClose(Cancel As Boolean) '¬O ThisWorkbookªºµ{§Ç ¦¹¬¡¶Ã¯Ãö³¬®É ¦Û°Ê°õ¦æªºµ{¦¡
- '---------------------------------------------------
- Private Sub Auto_Open() '---* ¤@¯ë¼Ò²Õ(Module1)ªºµ{§Ç ¦¹¬¡¶Ã¯¶}±Ò®É ¦Û°Ê°õ¦æªºµ{¦¡
- StartProcedure
- End Sub
- Private Sub Auto_Close() '---* ¤@¯ë¼Ò²Õ(Module1)ªºµ{§Ç ¦¹¬¡¶Ã¯Ãö³¬®É ¦Û°Ê°õ¦æªºµ{¦¡
- StopProcedure
- ThisWorkbook.Save
- End Sub
- Sub StartProcedure()
- '----- ¥i³] «ö¶s «ü©w¦¹¥¨¶°¤â°ÊÀ³¥Î-------
- '------±Ò°Ê Dee_Set µ{§Çªº °õ¦æ¥¨¶°-------
- If ¦¬½L Is Nothing Then Time_Set 'Åܼƥ¼³]©w
- If Sheets("Sheet1").[A2] <> Date Then Sheets("Sheet1").UsedRange.Offset(1) = ""
- '·í¤é²Ä¤@¦¹¶}±ÒÀÉ®× ²M°£´N¦³Dee¸ê®Æ
- If Time > ¦¬½L Then '¤w¹L ¦¬½L®É¶¡
- MsgBox "¤w¹L " & ¦¬½L
- Else '¥¼¨ì ¦¬½L®É¶¡
- If Time >= ¶}½L And Time <= ¦¬½L Then 'ªÑ¥«¥æ©ö®É¶¡¤º
- If Time_Dee > ¶}½L Then Exit Sub '¹w¨¾«´_:' ¤U¦¸°õ¦æ Dee_Set ªº®É¶¡¤j©ó¶}½L®É¶¡
- Dee_Set
- Else '¥¼¶}½L«e
- ¦¸¼Æ = 0 '²M°£¬Q¤é¬ö¿ý DEE ¦¸¼Æ
- Time_Dee = #8:30:00 AM#
- Application.OnTime Time_Dee, "Dee_Set"
- MsgBox "¹w©w ©ó " & #8:30:00 AM# & "§ó·s Dee¸ê®Æ"
- End If
- End If
- End Sub
- Sub StopProcedure()
- '----- ¥i³] «ö¶s «ü©w¦¹¥¨¶°¤â°ÊÀ³¥Î-------
- '------°±¤î Dee_Set µ{§Çªº °õ¦æ¥¨¶°-------
- On Error Resume Next
- Application.OnTime Time_Dee, "Dee_Set", , False
- Time_Dee = #12:00:00 AM# '¤U¦¸°õ¦æ Dee_Set ªº®É¶¡: ¤p©ó¶}½L®É¶¡
- End Sub
- Private Sub Time_Set() 'ÅÜ¼Æ ³]©w
- With Sheets("DATA")
- Set ¶}½L = .Range("X5") '¶}½L®É¶¡
- Set ¦¬½L = .Range("Y5") '¦¬½L®É¶¡
- Set ¦¸¼Æ = .Range("X6") '¬ö¿ý DEE ¦¸¼Æ
- Set ¶¡¹j = .Range("Y6") '¶×¤JDEEªº ®É¶¡¶¡¹j
- ¶}½L = "8:30:00"
- ¦¬½L = "13:30:00"
- If ¶¡¹j = "" Then ¶¡¹j = "00:01:00" '¥¼³]¥¼³]¥ß ¶¡¹j
- End With
- End Sub
- Private Sub Dee_Set()
- If Time > ¦¬½L Then Exit Sub
- '----------¬ö¿ý DEE -----------
- Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(1, 22).Value = Sheets("DATA").[A2:v2].Value
- ¦¸¼Æ = ¦¸¼Æ + 1 ' ¤Á°O Counter (p¼Æ¾¹) n¥[¤@¡A§_«h¥Ã»·¬°¹s (·íµM¤w¤]¥i¥H¤£¤©¬ö¿ý¸ê®Æ¦Cz¡A¨ÌÓ¤H²ß©Ê)¡C
- Time_Dee = Time + ¶¡¹j '¤U¦¸°õ¦æ Dee_Set ªº®É¶¡
- Application.OnTime Time_Dee, "Dee_Set"
- End Sub
½Æ»s¥N½X |
|