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

[µo°Ý] ¤£¤ÓÀ´¬°¤°»òmodule1¸òthisworkbookªºÃö«Y

[µo°Ý] ¤£¤ÓÀ´¬°¤°»òmodule1¸òthisworkbookªºÃö«Y

±qºô¸ô¤W§ä¨ìªºDDE¬ö¿ýµ{¦¡¡A¾Ç²ß¤W¡A¤£À´¬°¤°»òmodule1¸òthisworkbook?³£­n°µ¬Û¦PªºÅܼƫŧi¤]³£¦³ExeSelf()ªº¨ç¼Æ?
­ì¥»¥H¬°¦bmodule1¤W«Å§iÀ³¸Ó´N³£¥i¥H¨Ï¥Î¤~¹ï¡C
¦ý¬O¹ê»Ú´ú¸Õ¤W§R±¼¨ä¤¤¤@­ÓÅܼƫŧi©Î¬OExeSelf()¡Aµ{¦¡´N¶]¤£°Ê¤Fµo¥Í¥¨¶°¿ù»~¡C
·|·Q­n§R±¼¨ä¤¤¤@­Ó¬O¦]¬°¦³®É­Ô¶]¤@¶]­ì¥»¤@¤ÀÄÁ°O¾Ð¤@¦¸«oÅܦ¨30¬í°O¾Ð¤@¦¸¡C
½Ð«üÂI¤@¤U¡A«D±`·PÁ¡C
Module1
Dim i, j As Single
Dim Min_Bar(1000, 6) As Variant 'Time, O,H,L.C,V
Dim O As Single
Dim H As Single
Dim L As Single
Dim C As Single
Dim V As Single
Dim NP As Single

Sub Ãö³¬DDE¦Û°Ê¥æ©ö¨t²Î()
    On Error Resume Next
    Application.OnTime Now + TimeValue("00:00:02"), "ThisWorkBook.ExeSelf", , False
End Sub
Sub ±Ò°ÊDDE¦Û°Ê¥æ©ö¨t²Î()
    Dim k As Single
    j = 2
    Application.OnTime TimeValue("08:45:00"), "ExeSelf"
    'Call ExeSelf
End Sub

Private Sub ExeSelf()
    On Error Resume Next
    i = i + 1
    If i = 58 Then
        Sheets(2).Cells(j, 1) = Time
        Sheets(2).Cells(j, 2) = O
        Sheets(2).Cells(j, 3) = H
        Sheets(2).Cells(j, 4) = L
        Sheets(2).Cells(j, 5) = C
        Sheets(2).Cells(j, 6) = V
        j = j + 1
        i = 0: V = 0
        O = Sheets(1).Cells(2, 2)
        V = V + Sheets(1).Cells(2, 4)
        H = O: L = O: C = O
    Else
        '¥H¤U§PÂ_°j°éÅý§ë¸êÅv­«»P§ë¸ê¼Ðªºª«¦WºÙ³]©w¡A¶È°õ¦æ¤@¦¸
        C = Sheets(1).Cells(2, 2)
        If C > H Then H = C
        If C < L Then L = C
        V = V + Sheets(1).Cells(2, 4)
'        Sheets(2).Cells(i, 1) = Sheets(1).Cells(2, 2)
    End If
        Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkBook.ExeSelf"
End Sub

ThisWorkbook
Dim i, j As Single
Dim Min_Bar(1000, 6) As Variant 'Time, O,H,L.C,V
Dim O As Single
Dim H As Single
Dim L As Single
Dim C As Single
Dim V As Single
Dim NP As Single
Private Sub Workbook_Open()
    j = 2
    'Call ExeSelf
End Sub
Private Sub ExeSelf()
    On Error Resume Next
    i = i + 1
    If i = 60 Then
        Sheets(2).Cells(j, 1) = Time
        Sheets(2).Cells(j, 2) = O
        Sheets(2).Cells(j, 3) = H
        Sheets(2).Cells(j, 4) = L
        Sheets(2).Cells(j, 5) = C
        Sheets(2).Cells(j, 6) = V
        j = j + 1
        i = 0: V = 0
        O = Sheets(1).Cells(2, 2)
        V = V + Sheets(1).Cells(2, 4)
        H = O: L = O: C = O
    Else
        '¥H¤U§PÂ_°j°éÅý§ë¸êÅv­«»P§ë¸ê¼Ðªºª«¦WºÙ³]©w¡A¶È°õ¦æ¤@¦¸
        C = Sheets(1).Cells(2, 2)
        If C > H Then H = C
        If C < L Then L = C
        V = V + Sheets(1).Cells(2, 4)
'        Sheets(2).Cells(i, 1) = Sheets(1).Cells(2, 2)
    End If
        Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkBook.ExeSelf"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    'Application.OnTime Now + TimeValue("00:00:10"), "ThisWorkBook.ExeSelf", , False
End Sub

DDE¤U³æ¨t²Î.zip (35.83 KB)

¦^´_ 1# ddtggg
"ThisWorkBook.ExeSelf" »P "ExeSelf" ¹ê½è¤W¬O¨â­Ó¤£¦Pªº
«Å§i¨ç¦¡¡C ¤@­Ó«Å§i©ó ThisWorkBook µ{¦¡°Ï°ì¤¤¡F¥t¤@­Ó«h«Å§i
©ó Module1 ¼Ò²Õ¤¤¡C¤£¥©ªº¬O¨âªÌ³£¨Ï¥Î¦P¤@µ{¦¡¦WºÙ¤§©R¦W¡C
¦pªG±N¥¦­Ì­Ó§O«Å§i¦¨ A()¡B¥H¤Î B() ®É«hµL¦¹§x´b¡C
¦¹³B "ThisWorkBook.ExeSelf" ¬O¥h©I¥s ThisWorkBook ¤¤ªº
Sub ExeSelf() ¨ç¦¡¡F ¦Ó ExeSelf «h·|¥h°õ¦æ Module1 ¼Ò²Õ
¤¤ªº Sub ExeSelf() ¨ç¦¡¡A ¦Ó«D ThisWorkBook ¤¤ªº Sub ExeSelf()¡C
¦p¦¹¸ÑµªÁA¸Ñ§_¡H

TOP

¦^´_ 2# c_c_lai
¦³¤@ÂIÀ´¡C²³æ»¡´N¬O§âModlue1³Ì©³¤Uthisworkbook.ExeSelf§ï¦¨«ü¨ìExSelf¡A´N¤£·|¶¨Ó¶¥h¤F¡C
....²¤
End If
        Application.OnTime Now + TimeValue("00:00:01"), "ExeSelf"
End Sub

§ï§¹¤§«á¹ï®É¶¡¦³¤@­ÓºÃ°Ýorz¡A´N¬O©ú©ú¼g¬Oi=1 if i=30 Then¬ö¿ý
¦ý®É¶¡°O¿ý¤W³£¬O29¬í59¬í29¬í59¬í¦Ó¤£¬O30 00 30 00 ·Q¤£³z

TOP

¦^´_  c_c_lai
¦³¤@ÂIÀ´¡C²³æ»¡´N¬O§âModlue1³Ì©³¤Uthisworkbook.ExeSelf§ï¦¨«ü¨ìExSelf¡A´N¤£·|¶¨Ó¶¥h ...
ddtggg µoªí©ó 2018-9-12 11:36

½Ðªþ¤W¥Ø«e´£°ÝªºÀɮסA¤è«K¬d¹ï¡C
Ä´¦p¡G if i = 30 then µ¥»yªk¦b­þ¸Ì¡C

TOP

i=1
0¬í~29¬í, i=i+1, ¸õ30¦¸, ­è­è¦n~~

TOP

¦^´_ 5# ­ã´£³¡ªL


    ­ì¨Ó¦p¦¹¡AÁÂÁ´£ÂI¡C
    ¥»¨Ó¥H¬°±q08:45:00¶}©l¸g¹Lªº®É¶¡0~1¬í¤~ºâ1¬í¡A1~2¬íºâ¤U¤@¬í³o¼Ë¡C
    ­ì¨Ó0¬í¡B1¬í¡B2¬í...
  
Private Sub ExeSelf()
    On Error Resume Next
    i = i + 1
    If i = 30 Then
        Sheets(2).Cells(j, 1) = Time
        Sheets(2).Cells(j, 2) = O
        Sheets(2).Cells(j, 3) = H
        Sheets(2).Cells(j, 4) = L
        Sheets(2).Cells(j, 5) = C
        Sheets(2).Cells(j, 6) = V
        j = j + 1
        i = 0: V = 0
        O = Sheets(1).Cells(2, 2)
        V = V + Sheets(1).Cells(2, 4)
        H = O: L = O: C = O
    Else
        '¥H¤U§PÂ_°j°éÅý§ë¸êÅv­«»P§ë¸ê¼Ðªºª«¦WºÙ³]©w¡A¶È°õ¦æ¤@¦¸
        C = Sheets(1).Cells(2, 2)
        If C > H Then H = C
        If C < L Then L = C
        V = V + Sheets(1).Cells(2, 4)
'        Sheets(2).Cells(i, 1) = Sheets(1).Cells(2, 2)
    End If
        Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkBook.ExeSelf"
End Sub

¥t¥~·Q¦A½Ð°Ýi=i+1 If  i=30 Then ¬ö¿ý Else§PÂ_¶}°ª§C¦¬ End If ¤U¤@¬íÄ~Äò°õ¦æ
Else§PÂ_ªº³¡¤À¬O¤£¬O°õ¦æi=0~²Ä28¬í³£¦b§PÂ_  ²Ä29¬í¤~¬ö¿ý
¦]¬°¥L¼g¶È°õ¦æ¤@¦¸¡A¦ý«ç»òı±o¦n¹³¨C¬í³£¦b§PÂ_¡C

TOP

¦^´_ 6# ddtggg
Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkBook.ExeSelf"
¨C¬í (Now + TimeValue("00:00:01")) ³£·|±Ò°Ê°õ¦æ "ThisWorkBook.ExeSelf"
¤º¤§ If i = 30 Then ~  Else ~ End If §PÂ_¡C

TOP

¦^´_ 6# ddtggg


ELSE ¤¤ªº°Ñ¼Æ, ­Y¨S¦³§PÂ_¤Î¦s¨ú,
µ¥ i=30 ®É, ´N¨S¦³°Ñ¼Æ¥i¥Î, À³¤£¥i¬Ù²¤,
¦A»¡¨º¨Ç§PÂ_¤]À³¤£¼vÅTÀɮתº¹B§@§a!

TOP

¥»©«³Ì«á¥Ñ ddtggg ©ó 2018-9-24 18:43 ½s¿è

¦^´_ 8# ­ã´£³¡ªL

Private Sub ExeSelf()
    On Error Resume Next
    i = i + 1
    If i = 58 Then
        Sheets(2).Cells(j, 1) = Time
        Sheets(2).Cells(j, 2) = O
        Sheets(2).Cells(j, 3) = H
        Sheets(2).Cells(j, 4) = L
        Sheets(2).Cells(j, 5) = C
        Sheets(2).Cells(j, 6) = V
        j = j + 1
        i = 0: V = 0
        O = Sheets(1).Cells(2, 2)
        V = V + Sheets(1).Cells(2, 4)
        H = O: L = O: C = O
    Else
        '¥H¤U§PÂ_°j°éÅý§ë¸êÅv­«»P§ë¸ê¼Ðªºª«¦WºÙ³]©w¡A¶È°õ¦æ¤@¦¸
        C = Sheets(1).Cells(2, 2)
        If C > H Then H = C
        If C < L Then L = C
        V = V + Sheets(1).Cells(2, 4)
'        Sheets(2).Cells(i, 1) = Sheets(1).Cells(2, 2)
    End If
        Application.OnTime Now + TimeValue("00:00:01"), "ThisWorkBook.ExeSelf"
End Sub

¦b    On Error Resume Next ¥[¤W If (TimeValue(Now) > Sheets("MinBar").Range("N1").Value) Then Exit Sub
«h¥u¦³°O¿ý®É¶¡¡C
¦pªG§ï¥[¦belse«á­±´N¥i¥H°O¿ý¶}°ª¦¬§C¡A¹ê¦b¬O¤£À´¬°¤°»ò?½Ð«ü¾ÉÁÂÁ¡C
¥t¥~§Ú·Ó§Û¥t¤@­Ó¼gªk·Q¦h°O¿ý¤@­Ó¶}°ª¦¬§C¡A³o­Ó¼gªk¤W«o¤°»ò¨Sµo¥Í¡C½Ð°Ñ¦ÒDDEv11 v21

DDEv11.rar (35.67 KB)

­ì©lÀÉ

DDEv21.rar (41.96 KB)

·Q¦h¤@­Ó°O¿ý

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD