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

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

¦^´_ 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

¦^´_ 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

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

§Ú¬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

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD