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

DDE¸ê®Æ§ì¨ú,³v®æÅã¥Ü°ÝÃD

DDE¸ê®Æ§ì¨ú,³v®æÅã¥Ü°ÝÃD

½Ð°Ý¦U¦ì¤j¤j,
¦bDDE¤¤, §Ú»Ý­n¨C10¤ÀÄÁ§ì¨ú¸ê®Æ.
¦ý­n³v®æÅã¥Ü,
·N«ä¦p¤U:
8:45´Á³f¶}½L....²Ä¤@µ§¸ê®Æ
8:55......²Ä¤Gµ§¸ê®Æ
9:05......²Ä¤Tµ§¸ê®Æ
.....¥H¦¹Ãþ±À.
Àɮפ¤,
Sheet1...¬O¨÷°ÓDDE¸ê®ÆÅÜ°Ê.
Sheet2...¨C¤Q¤ÀÄÁ§ì¨ú¸ê®Æ.
³o­n¦p¦ó¼g©O?
Jackson

§Ú¬O¤@­Ó·~¾lªÑ²¼±Ú,¦bºô¸ô¤W¤U¸ü¤@¨Ç¦³ÃöªÑ²¼ªºExcelµ{¦¡,Á`ı±o¤£§¹¥þ²Å¦X­Ó¤H»Ý¨D,©Ò¥H¦³ªÅ§Ú·|­×§ï©Î¥[±j¤U¸üµ{¦¡,¨Ñ­Ó¤H¨Ï¥Î,¦ý¦]©ÈIJ¥Ç´¼¼z°]²£Åv,©Ò¥H¤£´±°e¥L¤H¨Ï¥Î,¤]¤£´±¦bºô¸ô¤W¤½¶}.
Lin

TOP

1 ¦b³oºô­¶¬d¸ßªÑ²¼ªº¥N¸¹,InStr(.ResultRange.Rows(3).Cells(1), ¥N¸¹), ¬°¤ñ¹ï ¶×¤Jªº¸ê®Æ¬O§_¥]§tªÑ²¼ªº¥N¸¹  ·í¦¹¨ç¼Æ¬°0 ®Éªí¥Ü¨S¦³³o­ÓªÑ²¼¥N¸¹
2 ¤£¥Îstatic,´N¬O·|¥X²{°ÝÃD...
  ¤£¥Îstatic,¥i¦b¼Ò²Õ³Ì¤W¤è Dim Run_Time As Date  ³]¬° ¼Ò²Õªº¨p¥ÎÅܼÆ.

TOP

¦^´_ 11# GBKEE
¦hÁ¸ѵª,¦ý¬°¤°»ò­n°µ³o¼Ëªº°Ê§@?
(1) ·íinstr(........,¥N¸¹) = 0,µ{¦¡·|¸õ¨ì³Ì«árefresh_err¦Ó¤£·|°µ¦¨­«·s©I¥smydee,²{¦b«o­n¯S·N¥s°±?
(2) static¤@¦r,ªí­±¬Ý¨ä¹ê¥Î©M¤£¥Î¤]¨S¤À§O. ¦]¬°­«ÂйB¦æ, run_timeªº­È¬Onow+timevalue("00:00:10"),§¹¥þ¤£»ÝÄ~©Órun_time¤§«eªº¼Æ­È; ¤£­«ÂйB¦æ,«K·|¬Oapplication ontime 0:00:00,mydee,,false,¤]¤£¥Î«e­±ªº­È. ¦ý¬O¤£¥Îstatic,´N¬O·|¥X²{°ÝÃD.
§Úªº²z¸Ñ¨s³º¨º¸Ìµo¥Í°ÝÃD?
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 10# FAlonso
Private Sub MyDee()
    Dim Sh As Worksheet, Rng As Range, ¥N¸¹ As String
    Static Run_Time As Date            'Static ³¯­z¦¡«Å§iªºÅܼơA¦bµ{¦¡°õ¦æ´Á¶¡¡A·|¤@ª½«O¯d¤º®e
  ' If Time > TimeValue("13:30") Then Exit Sub     ' ¦¬½L®É¶¡«á °±¤î°õ¦æ
    Set Sh = Sheets("¬ö¿ý")
    ¥N¸¹ = Sheets("¬ö¿ý").[C1]
    Sh.Activate
    With Sheets("¶×¤J").QueryTables(1)
        .Connection = "URL;http://tw.stock.yahoo.com/q/q?s=" & ¥N¸¹
       .Refresh False
        If InStr(.ResultRange.Rows(3).Cells(1), ¥N¸¹) = 0 Then GoTo Refresh_Err:
       Application.EnableEvents = False
        Set Rng = Sh.Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(1, .ResultRange.Columns.Count - 1)
        Rng.Value = .ResultRange.Rows(3).Value
        Application.EnableEvents = True
        Rng.Select
    End With
    Run_Time = Now + TimeValue("00:00:10")
    Application.OnTime Run_Time, "MyDee"  '³]©w 10¬í«á °õ¦æ MyDee µ{§Ç
    Exit Sub
Refresh_Err:
    On Error Resume Next
    Application.OnTime Run_Time, "MyDee", , False  '²M°£¥ý«e³]©wªºµ{§Ç
    MsgBox "§ä¤£¨ì " & Sheets("¬ö¿ý").[C1] & " ªÑ²¼"
End Sub

TOP

¦^´_ 9# GBKEE
ÁÂÁÂ
§Ú¥t¥~¦b"¬ö¿ý"¤@­¶¥[¤F¥H¤Uµ{¦¡
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. If Target.Count > 1 Or Target.Address <> "$C$1" Then
  3. Exit Sub
  4. Else
  5. Sheet2.Range("A3:K65536").Clear
  6. myprogram  '©MmyDEEªºµ{¦¡¤@¼Ë
  7. End If
  8. End Sub
½Æ»s¥N½X
­ì·N¬O·Q·íC1®æ¤lªÑ²¼½s¸¹ÅÜ°Ê®É,²MªÅ"¬ö¿ý"ªº¸ê®Æ¥H¤Þ¤J·sªÑ²¼°T®§
¦³¤@ÂI¤p°ÝÃD,·í¸ÓªÑ²¼½s¸¹¤£¦s¦b®É,·|¤Þµo¨â¦¸"¨S¦³¸ÓªÑ²¼"ªºmsgbox
²z½×¤WÅã¥Ümsgbox«áÀ³¸Ó¤°»ò¤]¤£°Ê,¤£¹Lµ{¦¡«oÃB¥~³s½u¦Üweb,µM«á¦A°õ¦æmsgbox
§Ú¥ÎF8³v¦æµ{¦¡°õ¦æ¤]¥uÅã¥Ü¤@¦¸¦Ó¤w
¤£ª¾¦³¦ó¸Ñ¨Mªk?
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 8# jackson184
¨Ì¹Ï¤ù¦b§Aexcelªº vbaµøµ¡ ´¡¤J¤@¼Ò²Õ
¦^¨ì ½×¾Â  ¦p¹Ï
  «ö¤U ¡u½Æ»s¥N½X¡v«á·|Åã¥Ü [¥N½X¤w½Æ»s¨ì°Å¶Kï] ªº«H®§ ,¦^¨ì vbaµøµ¡¶K¤W§Y¥i





¦^´_ 7# FAlonso
If Time > TimeValue("13:30") Then
Exit Sub
End If
'''''''''''''''''''''''''''''''''''''''''
If Time > TimeValue("13:30") Then  Exit Sub
¦¹¬°Â²¤Æ ³£¬O¥i¹F¨ì¤@¼Ëªº®ÄªG

TOP

¥»©«³Ì«á¥Ñ jackson184 ©ó 2011-4-2 15:26 ½s¿è

¦^´_ 4# GBKEE


    ÁÂÁÂGBKEE¤j¤j,
¦]¬°§ÚÁÙ¬O¤p¾Ç¥Í,
ÁÙ¤£¯à¤U¸ü±zªº½d¨Ò.
§Ú¦A¸Õ¬Ý¬Ý, ¤£À´¦A½Ð±Ð±z.
Jackson

TOP

¦^´_ 6# GBKEE
ÁÂÁ¦^ÂÐ,¤£¹L¦³´XÂI°ÝÃD
¦]¬°GBKEE¤j¤j¨S¦³¼gend if,Ū°_¨Ó¦³ÂI¤£ºD
µ{¦¡¬O§_«ü
  1. If Time > TimeValue("13:30") Then
  2. Exit Sub
  3. End If
  4. ...
  5. ...
  6. ...

  7. If InStr(.ResultRange.Rows(3).Cells(1), stockcode) = 0 Then  
  8. GoTo refresh_err:
  9. Else

  10. Application.EnableEvents = False

  11. Set myrange = mysheet.Range("a65536").End(xlUp).Offset(1).Resize(1, .ResultRange.Columns.Count - 1)
  12. myrange.Value = .ResultRange.Rows(3).Value

  13. Application.EnableEvents = True

  14. myrange.Select

  15. End If
  16. End With

  17. Application.OnTime Now + TimeValue("00:00:10"), "myprogram"

  18. exit sub   ³o­Óexit sub¬O¹ïÀ³¤°»ò

  19. refresh_err:
  20. MsgBox "Stock " & stockcode & " cannot be found"

  21. End Sub
½Æ»s¥N½X
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-4-1 16:52 ½s¿è

¦^´_ 5# FAlonso
¼Ó¥D¬O¥Î¬Ý½L³nÅ骺
¸Õ¸Õ¬Ý,¥i¿ï¾ÜªÑ²¼,10¬í¬ö¿ý¤@¦¸.

ªÑ²¼¬ö¿ý.rar (14.88 KB)

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD