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

[µo°Ý] µLªk¶×¤JPCHOME ªÑ¥«¸ê®Æ

[µo°Ý] µLªk¶×¤JPCHOME ªÑ¥«¸ê®Æ

§Ú·Q­n¶×¤JPCHOME ªÑ¥«¸ê®Æ ¦p¤U«o³£¬OªÅ¥Õ ©Î¬O±q"¸ê®Æ"->±qWEB «o±o¨ì ¦¹WEB¬d¸ß¨S¦³¸ê®Æ¶Ç¦^ ªº¿ù»~°T®§ ¦³°ª¤â¥i¥H¸Ñ´b¶Ü

    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://pchome.syspower.com.tw/stock/sto2/ock2/sid2330.html", Destination:=Range( _
        "A1"))

¦^´_ 1# chairmen100
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Pchome_°]°È¤ñ²v()
  3.     Dim A As Object, i As Integer, C As Variant
  4.     With CreateObject("InternetExplorer.application")
  5.         .Navigate "http://pchome.syspower.com.tw/stock/sto2/ock2/sid2330.html"
  6.         .Visible = True
  7.         Do While .Busy Or .ReadyState <> 4
  8.              DoEvents
  9.         Loop
  10.         Set A = .Document.getelementsbytagname("table")(4)
  11.         With ActiveSheet
  12.             .Cells.Clear
  13.             For i = 1 To A.Rows.Length - 1
  14.                 For C = 0 To A.Rows(i).Cells.Length - 1
  15.                    .Cells(i, C + 1) = A.Rows(i).Cells(C).innertext
  16.                 Next
  17.             Next
  18.             With .UsedRange
  19.                 .Columns(.Columns.Count).SpecialCells(xlCellTypeConstants).Offset(, -9).Delete xlShiftToLeft
  20.             End With
  21.        End With
  22.        .Quit
  23.     End With
  24.     MsgBox "OK"
  25. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


   ·PÁÂG¤j µ²ªG²Å¦X´Á±æ

TOP

GBKEE¶Wª©¹ï¬d¸ßªÑ²¼µ{¦¡«Ü¼F®`¡A¦pªG¯à¾ã²z¦¨±M¿èÀ³¸Ó¥i¥H³yºÖ«Ü¦h¤H¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_  chairmen100
¸Õ¸Õ¬Ý
GBKEE µoªí©ó 2013-9-27 17:08



    ¯u¬O³yºÖ¤j®a~·PÁÂ
¥«³õ¨ú¨M©ó«H¤ß.
¥æ©ö¶¶§Q

TOP

½Ð±ÐGBKEE¤j¤j:
¥H¤Uªººô­¶¦³¹Ï¡A¤S¸Ó¦p¦ó³B²z¡H(¨ä¹ê¥u­n¼Æ¦r¸ê®Æ´N¥i¥H¤F)¡A³Â·Ð±z¦³ªÅ¬Ý¤@¤U¡AÁÂÁ¡C
http://pchome.syspower.com.tw/stock/sto0/ock2/sid1319.html

TOP

¦^´_ 6# tajen
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Pchome_»ù¶q¤À¥¬()
  3.     Dim A As Object, i As Integer, C As Variant, Sh As Worksheet, Stock As String
  4.     Do
  5.         Stock = InputBox("¿é¤JªÑ²¼¥N¸¹", "ªÑ²¼¥N¸¹", 2303)
  6.     Loop Until Len(Stock) >= 4
  7.     Set Sh = ActiveSheet                   '¥i«ü©w¤u§@ªí
  8.     With CreateObject("InternetExplorer.application")
  9.         .Navigate "http://pchome.syspower.com.tw/stock/sto0/ock2/sid" & Stock & ".html"
  10.         .Visible = True
  11.         Do While .Busy Or .ReadyState <> 4
  12.              DoEvents
  13.         Loop
  14.         Sh.Cells.Clear
  15.         Set A = .Document.getelementsbytagname("table")(0)
  16.         For i = 0 To A.Rows.Length - 1
  17.             For C = 0 To A.Rows(i).Cells.Length - 1
  18.                 ActiveSheet.Cells(i + 1, C + 1) = A.Rows(i).Cells(C).innertext
  19.             Next
  20.         Next
  21.         Set A = .Document.getelementbyid("content")
  22.         For i = 0 To A.Rows.Length - 1
  23.             For C = 0 To A.Rows(i).Cells.Length - 1
  24.                 ActiveSheet.Cells(i + 4, C + 1) = A.Rows(i).Cells(C).innertext
  25.             Next
  26.         Next
  27.         Sh.UsedRange.EntireColumn.AutoFit
  28.        .Quit
  29.     End With
  30.     MsgBox "OK"
  31. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 7# GBKEE

«Ü±j¤j,GBKEE¤j¤j. ®M¥Î¦b¤u§@¤W, «D±`¦³®Ä²v. ­n¦n¦n°Ñ¸Ô

TOP

¤£¦n·N«ä¡A²{¦b¤~¨Ó¬Ý¦^ÂСA¨S·Q¨ìGBKEE¤j¤j¦­´N¼g¦n¤F¡A´ú¸Õªºµ²ªG:§¹¬üµL¯Ê¡C
¤Ó·PÁÂGBKEE¤j¤j¡A·P®¦!
±z¹ê¦b¤Ó¼F®`¤F¡A§Ú­n¦n¦n¨Ó¬ã¨s¤@¤U§Aªº³o¤G½gcode¡A§Æ±æ¥H«á³£¥i¦Û¤v§âµ{¦¡¼g¥X¨Ó¡C

·Q½Ð±Ð¥t¥~¤@­Ó°ÝÃD:  ¦p¦ó©w¦ìºô­¶¤¤¦³Tabªº¦ì¸m
¨Ò¦p: http://www.cnyes.com/twstock/quote/6121.htm ¤¤ªº²Ä¤T­ÓTab(»ù¶q¹Ï)ªº¸ê®Æ

¦]¬°­Yª½±µ¥Îexcel¶×¤Jªº¤è¦¡¡A³£¥u·|§ì¨ì²Ä¤@­ÓTab(³Ì¨Î¤­ÀÉ)ªº¸ê®Æ¡A
¥i§_³Â·Ð±z¦³ªÅ¬Ý¤@¤U¡AÁÂÁÂ!!!

TOP

¤U­±¬Oºô­¶ªºªí®æ¡A§ï¦¨7´N¦æ¤F

Sub Macro2()
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://traderoom.cnyes.com/tse/quote2FB.aspx?code=6121", Destination:= _
        Range("A1"))
        .Name = "quote2FB.aspx?code=6121"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "7"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub

TOP

        ÀR«ä¦Û¦b : §Ñ¥\¤£§Ñ¹L¡A§Ñ«è¤£§Ñ®¦¡C
ªð¦^¦Cªí ¤W¤@¥DÃD