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

vba¶×¤J¨é°Ó¶i¥Xªí

vba¶×¤J¨é°Ó¶i¥Xªí

thanks.rar (12.69 KB) http://yamstock.megatime.com.tw/asp/stockinfo/ps_top.asp?m=all&stockid=3474&name1=D2&index1=6
³o¬Oyan¨é°Ó¶i¥Xªí
·Q¥Îvba¶×¤Jexcel «ü©w¤u§@ï¤Î¦sÀx®æ
¦p2888·s¥úª÷¶×¤J"sheet2", "A1"
2409¤Í¹F¶×¤J"sheet2", "A60"
¥H¤Uµ{¦¡½X¬O§Úºô¸ô·j´M¨Ã¨Ì§Úªº»Ý­n¦Û¦æ俢§ï
¦ý¬OÁÙ¬OµLªk°õ¦æ
½Ð«e½úÀ°¦£¬Ý¬Ý
¨ì©³¨º¸Ì¿ù»~   ÁÂÁÂ
   

Sub GetTransInfo()
Worksheets("sheet2").Activate
Call ¨é°Ó¶i¥X("2888", "sheet2", "A1")
Call ¨é°Ó¶i¥X("2409", "sheet2", "A60")
End Sub
     Sub ¨é°Ó¶i¥X(stock As String, tsheet As String, tcell As String)
Call¨é°Ó¶i¥X("all&stockid", "8,10,11", stockinfo, tsheet, tcell)
End Sub
Sub¨é°Ó¶i¥X(all&stockid, tbl As String, stock As String, tsheet As String, tcell As String)
     With Worksheets(tsheet).QueryTables.Add(Connection:="URL;http://yamstock.megatime.com.tw/asp/stockinfo/ps_top.asp?m=all&stockid=" & _
     stockNo &  "&name1=D2&index1=6, _
        .Destination:=Worksheets(tsheet).Range(tcell))
        .Name = all & "_" & stock
         .FieldNames = True
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = False
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = tbl
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

    End Sub

§A¥i¥H¸Õ¸Õ¤@¥y¤@¥y¸Õ¸Õ¤F¸Ñ¤@¤U·N«ä
  1. Sub GetTransInfo()
  2. Worksheets("sheet2").Activate
  3. Call ¨é°Ó¶i¥X("2885", "sheet2", "A1")
  4. 'Call ¨é°Ó¶i¥X("2409", "sheet2", "A60")
  5. End Sub
  6. Sub ¨é°Ó¶i¥X(stock As String, tsheet As String, tcell As String)
  7.     '"all&stockid",
  8.     Call ¨é°Ó¶i¥X2("8,10,11", stock, tsheet, tcell)
  9. End Sub

  10. '(all&stockid,
  11. Sub ¨é°Ó¶i¥X2(tbl As String, stock As String, tsheet As String, tcell As String)
  12.      With Worksheets(tsheet).QueryTables.Add(Connection:="URL;http://yamstock.megatime.com.tw/asp/stockinfo/ps_top.asp?m=all&stockid=" & _
  13.         stock & "&name1=D2&index1=6", _
  14.         Destination:=Worksheets(tsheet).Range(tcell))
  15.         .Name = all & "_" & stock
  16.          .FieldNames = True
  17.         .FieldNames = True
  18.         .RowNumbers = False
  19.         .FillAdjacentFormulas = False
  20.         .PreserveFormatting = True
  21.         .RefreshOnFileOpen = False
  22.         .BackgroundQuery = False
  23.         .RefreshStyle = xlOverwriteCells
  24.         .SavePassword = False
  25.         .SaveData = True
  26.         .AdjustColumnWidth = True
  27.         .RefreshPeriod = 0
  28.         .WebSelectionType = xlSpecifiedTables
  29.         .WebFormatting = xlWebFormattingNone
  30.         .WebTables = tbl
  31.         .WebPreFormattedTextToColumns = True
  32.         .WebConsecutiveDelimitersAsOne = True
  33.         .WebSingleBlockTextImport = False
  34.         .WebDisableDateRecognition = False
  35.         .WebDisableRedirections = False
  36.         .Refresh BackgroundQuery:=False
  37.     End With

  38.     End Sub
½Æ»s¥N½X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

·PÁª©¥Dkimbal
¥¿½T¸Ñ¨MµL»~
ª©¥D¦^ÂÐ
§A¥i¥H¸Õ¸Õ¤@¥y¤@¥y¸Õ¸Õ¤F¸Ñ¤@¤U·N«ä
¬O§r·s¤â´N¬O¤@­Ó¦r¤@­Ó¦rªº¾Ç²ß

TOP

®¦   ª©¥D¥Î¤ß¤F  ÁÂÁÂ

TOP

²Ä8¦æªº"8,10,11"
²Ä16¦æªº.Name = all & "_" & stock
²Ä31¦æªº.WebTables = tbl
¬O¤°»ò·N«ä?
80 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

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