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

½Ð°Ý call ªº°ÝÃD

½Ð°Ý call ªº°ÝÃD

½Ð°Ý¤W¦¡¥i°õ¦æ§ï¬°¤U­±ªºcall´N¤£¯à¡AÁÂÁÂ
¥²¶·¬O±`¦¡¹Bºâ¦¡
--------------------------------------------------
¤Þ¥Î [µo°Ý] ¨D§U~¤@­Ó¥ÎVBA±qºô­¶¨ú±o·Q­n¸ê®Æªº¼gªk~


'Private Sub CommandButton1_Click()
'    ' Const url As String = "http://jsjustweb.jihsun.com.tw/z/zc/zck/zck_6257.asp.htm"
'    Const url As String = "http://yamstock.megatime.com.tw/asp/stockinfo/GetReport.asp?select_table=html\Ficxxx\&stockid=2002&name1=D4&index1=12"     ' ¥¿½Tªº
'
'    Cells.Clear
'
'    Set ie = CreateObject("internetexplorer.application") '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"
'
'    With ie
'        .Visible = False 'True¬°¶}±Òie, False¬°¤£¶}±Òie
'        .Navigate url
'        Do While .ReadyState <> 4 'µ¥«Ýºô­¶¶}±Ò
'        DoEvents
'        Loop
'        .ExecWB 17, 2 'Select All
'        .ExecWB 12, 2 'Copy selection
'        Range("A1").Activate
'        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
'            False, NoHTMLFormatting:=True
'    End With
'
'    Columns("A:B").Delete    ' ±N¶×¤J®É A¡BB ¨âÄæ²¾°£¡A ­ì¥» C:I ªºÄæ¦ì¥þ³¡¥ª¾a¡A ¦¨¬° A:I
'    ie.Quit
'    MsgBox "¸ê®Æ½Æ»sµ²§ô"    ' Â÷¶}«eÅã¥Ü¤@¤pµøµ¡´£¿ô¡A«ö¥¦«á§Yµ²§ô¡C
'End Sub



Private Sub test2(ByVal ss As String)
    ' Const url As String = "http://jsjustweb.jihsun.com.tw/z/zc/zck/zck_6257.asp.htm"
    Const url As String = "http://yamstock.megatime.com.tw/asp/stockinfo/GetReport.asp?select_table=html\Ficxxx\&stockid=" & ss & "&name1=D4&index1=12"     ' ¥¿½Tªº

    Cells.Clear

    Set ie = CreateObject("internetexplorer.application") '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"

    With ie
        .Visible = False 'True¬°¶}±Òie, False¬°¤£¶}±Òie
        .Navigate url
        Do While .ReadyState <> 4 'µ¥«Ýºô­¶¶}±Ò
        DoEvents
        Loop
        .ExecWB 17, 2 'Select All
        .ExecWB 12, 2 'Copy selection
        Range("A1").Activate
        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
            False, NoHTMLFormatting:=True
    End With

    Columns("A:B").Delete    ' ±N¶×¤J®É A¡BB ¨âÄæ²¾°£¡A ­ì¥» C:I ªºÄæ¦ì¥þ³¡¥ª¾a¡A ¦¨¬° A:I
    ie.Quit
    MsgBox "¸ê®Æ½Æ»sµ²§ô"    ' Â÷¶}«eÅã¥Ü¤@¤pµøµ¡´£¿ô¡A«ö¥¦«á§Yµ²§ô¡C
End Sub

Sub test2_1()
Call test2("2002")
End Sub

¬¡­¶Ã¯1.rar (28.62 KB)

³øºp¡A¨S¬Ý²M·¡¡A¥i¥H¤F¡AÁÂÁÂ

Private Sub test2(ByVal ss As String)
Dim rr As String
rr = "http://yamstock.megatime.com.tw/asp/stockinfo/GetReport.asp?select_table=html\Ficxxx\&stockid=" & ss & "&name1=D4&index1=12"
    ' Const url As String = "http://jsjustweb.jihsun.com.tw/z/zc/zck/zck_6257.asp.htm"
    'Const url As String = "http://yamstock.megatime.com.tw/asp/stockinfo/GetReport.asp?select_table=html\Ficxxx\&stockid=" & ss & "&name1=D4&index1=12"     ' ¥¿½Tªº

    Cells.Clear

    Set ie = CreateObject("internetexplorer.application") '¨Ï¥Î¦¹¤è¦¡¥i¥H§K°£ "³]©w¤Þ¥Î¶µ¥Ø"

    With ie
        .Visible = False 'True¬°¶}±Òie, False¬°¤£¶}±Òie
        .Navigate rr
        Do While .ReadyState <> 4 'µ¥«Ýºô­¶¶}±Ò
        DoEvents
        Loop
        .ExecWB 17, 2 'Select All
        .ExecWB 12, 2 'Copy selection
        Range("A1").Activate
        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:= _
            False, NoHTMLFormatting:=True
    End With
Debug.Print rr
   Columns("A:B").Delete    ' ±N¶×¤J®É A¡BB ¨âÄæ²¾°£¡A ­ì¥» C:I ªºÄæ¦ì¥þ³¡¥ª¾a¡A ¦¨¬° A:I
    ie.Quit
    MsgBox "¸ê®Æ½Æ»sµ²§ô"    ' Â÷¶}«eÅã¥Ü¤@¤pµøµ¡´£¿ô¡A«ö¥¦«á§Yµ²§ô¡C
End Sub

Sub test2_1()
Call test2("2412")
End Sub

TOP

        ÀR«ä¦Û¦b : ¯àµ½¥Î®É¶¡ªº¤H¡A¥²¯à´x´¤¦Û¤v§V¤Oªº¤è¦V¡C
ªð¦^¦Cªí ¤W¤@¥DÃD