µù¥U
µn¿ý
º¶
½×¾Âª©³W
¸T¤î¦Cªí
»¡©ú
¦a¹Ï
¼Æ¦ì®Ñ»
¨p¤H®ø®§ (0)
¤½¦@®ø®§ (0)
½×¾Â¥ô°È (0)
¨t²Î®ø®§ (0)
¦n¤Í®ø®§ (0)
©«¤l®ø®§ (0)
³Â»¶®a±Ú°Q½×ª©ª©
»
Excelµ{¦¡°Ï
» Excel VBA ´Á¥æ©Ò¸ê®Æ¦Ûq¤é¼Æ¬d¸ß
ªð¦^¦Cªí
¤U¤@¥DÃD
¤W¤@¥DÃD
µo©«
[ì³Ð]
Excel VBA ´Á¥æ©Ò¸ê®Æ¦Ûq¤é¼Æ¬d¸ß
iamaraymond
µoµu®ø®§
¥[¬°¦n¤Í
iamaraymond
(Raymond Chien)
·í«eÂ÷½u
UID
30076
©«¤l
109
¥DÃD
12
ºëµØ
0
¿n¤À
177
ª÷¿ú
177
ÂI¦W
0
§@·~¨t²Î
win10
³nÅ骩¥»
office2013
¾\ŪÅv
20
©Ê§O
¨k
¨Ó¦Û
°ª¶¯
¦b½u®É¶¡
241 ¤p®É
µù¥U®É¶¡
2017-11-19
³Ì«áµn¿ý
2023-7-5
¡@¼ÊºÙ:
Raymond Chien
¤¤¾Ç¥Í
©«¤l
109
¥DÃD
12
ºëµØ
0
¿n¤À
177
ÂI¦W
0
§@·~¨t²Î
win10
³nÅ骩¥»
office2013
¾\ŪÅv
20
©Ê§O
¨k
¨Ó¦Û
°ª¶¯
µù¥U®É¶¡
2017-11-19
³Ì«áµn¿ý
2023-7-5
1
#
¸õÂà¨ì
»
˧Ǭݩ«
¥´¦L
¦rÅé¤j¤p:
t
T
µoªí©ó 2018-6-9 13:02
|
¥u¬Ý¸Ó§@ªÌ
[ì³Ð]
Excel VBA ´Á¥æ©Ò¸ê®Æ¦Ûq¤é¼Æ¬d¸ß
VBA
,
ºô¸ôª¦ÂÎ
,
§ë¸ê
¥»©«³Ì«á¥Ñ iamaraymond ©ó 2018-6-9 13:04 ½s¿è
Excel VBAºô¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html
¦¹µ{¦¡¬O±N¤W¦¸ªºµo¤åµy·L§ï¹L¡A¥i¥H¿é¤J·Qn¬d¸ßªº¤Ñ¼Æ
¦pªG·Q©T©w¬d¸ß¯S©w¤Ñ¼Æ¤]¥i¥Hª½±µ±Ninputbox¨º¤@¦æ§ï±¼
Sub test()
Cells.Clear
Dim myXML As Object
Set myXML = CreateObject("WinHttp.WinHttpRequest.5.1")
Dim myHTML As Object
Set myHTML = CreateObject("HTMLFile")
Dim clipboard As Object
Set clipboard = CreateObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
ReDim myArr(1 To 10, 1 To 20)
dateLR = Cells(Rows.Count, "A").End(xlUp).Row
myCount = 0
myDate = Date
myNumber = InputBox("½Ð¿é¤J¤Ñ¼Æ")
With myXML
Do
Application.Wait Now() + TimeValue("00:00:03")
myM = Format(Month(myDate), "00")
myD = Format(Day(myDate), "00")
.Open "POST", "http://www.taifex.com.tw/chinese/3/3_1_1.asp", False
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send "qtype=2&commodity_id=TX&commodity_id2=&market_code=0&goday=&dateaddcnt=0&DATA_DATE_Y=2018&DATA_DATE_M=05&DATA_DATE_D=22&syear=2018&smonth=" & myM & "&sday=" & myD & "&datestart=2018%2F05%2F15&MarketCode=0&commodity_idt=TX&commodity_id2t=&commodity_id2t2="
myHTML.body.innerHTML = convertraw(.responseBody)
'Debug.Assert InStr(1, myText, "10368") <> 0
Set myTables = myHTML.getElementsByTagName("table")
i = 1
textRow = (myNumber - 1 - myCount) * 12 + 5
For Each myTable In myTables
If myTable.getAttribute("width") = 965 Then
' textLR = Cells(myNumber * 12, "D")
' textLR = Cells(Rows.Count, "D").End(xlUp).Row
' textLR = IIf(textLR = 1, 5, textLR + 5)
Cells(textRow, 4).Select
Cells(textRow - 1, 4) = myTable.PreviousSibling.innerText
Cells(textRow - 1, 4).WrapText = False
With clipboard
.SetText myTable.outerHTML
.PutInClipboard
End With
Sheets("¤u§@ªí1").PasteSpecial NoHTMLFormatting:=False
myCount = myCount + 1
Exit For
End If
Next
myDate = myDate - 1
Loop Until myCount = CInt(myNumber)
End With
Application.StatusBar = "¬d¸ßµ§¼Æ:" & myNumber & "µ§"
Range("A2") = "¸ê®Æ½d³ò"
Range("A3") = Split(Split(Cells((myNumber - myCount) * 12 + 4, "D"), "¡G")(1), "»O")(0) & "~" & Split(Split(Cells((myNumber - 1) * 12 + 4, "D"), "¡G")(1), "»O")(0)
Set myXML = Nothing
End Sub
Function convertraw(rawdata)
Dim rawstr
Set rawstr = CreateObject("adodb.stream")
With rawstr
.Type = 1
.Mode = 3
.Open
.Write rawdata
.Position = 0
.Type = 2
.Charset = "UTF-8"
convertraw = .ReadText
.Close
End With
Set rawstr = Nothing
End Function
½Æ»s¥N½X
´Á¥æ©Ò¸ê®Æ¦Ûq¤é¼Æ¬d¸ß.zip
(41.05 KB)
¤U¸ü¦¸¼Æ: 40
2018-6-9 13:00
¼Ó¥D¼ö©«
¶°«O¸ê®Æ(§ïª©«á)
Excel VBA ¿ù»~³B²z¬yµ{(¥þ¹Ï¸Ñ)
VBAºô¸ôª¦ÂÎ(ºô¸ô¸ê®Æ»`¶°)
VBAºô¸ôª¦ÂÎ-XMLHTTPª«¥ó
Excel VBA ¦Û°Ê§ì¨ú´Á¥æ©Ò ´Á³f¨C¤é¥æ©ö¦æ±¡
[±Ð¾Ç¤å] §Q¥ÎVBA§ìªÑ»ù¸ê®Æ--§ä¥Xºô¯¸¸ê®Æ
ªí³æ°ÝÃD ½Ð°Ý¦p¦ó±±¨îcheckbox¼Æ¶q
½Ð°Ý³oÓ¥I¶O¥\¯à¬O¦p¦ó³]©wªº©O?
·Q½Ð±Ð¨Ï¥ÎFindWindow«ö¤U¹ï¸Ü®Øªº"Àx¦s"
¦¬ÂÃ
¤À¨É
Excel VBAºô¶¸ê®Æ¦¬¶°±Ð¾Ç:
http://forum.twbts.com/thread-20848-1-1.html
ÀR«ä¦Û¦b :
¡i®É¶¡¦pÆp¥Û¡j®É¶¡¹ï¤@Ó¦³´¼¼zªº¤H¦Ó¨¥¡A´N¦pÆp¥Û¯ë¬Ã¶Q¡F¦ý¹ï·M¤H¨Ó»¡¡A«o¹³¬O¤@§âªd¤g¡A¤@ÂI»ùȤ]¨S¦³¡C
ªð¦^¦Cªí
¤U¤@¥DÃD
¤W¤@¥DÃD
EXCEL±MÄÝ°Q½×°Ï
Excel£¸¯ë°Ï
Excelµ{¦¡°Ï
¶i¶¥À³¥Î±M°Ï
OFFICE ¨t¦C
Word
PowerPoint
Access
Office¤£¤À°Ï
µ{¦¡»y¨¥
VB »P VB.Net
C »P C#
Java »P J#
µ{¦¡³]p¤£¤À°Ï
¸ê®Æ®w
ORACLE
My SQL
MS SQL
ºô¶³]p
ASP »P ASP.NET
PHP
PHP+MySQL ¤Jªù¹ê§@
JavaScript
FLASH / ActionScript
HTM/ HTML/ CSS
ºô¶³]p¤£¤À°Ï
¹q¸£»P§@·~¨t²Î
¹q¸£¦UºØµwÅé°Q½×
¤@¯ë¹q¸£³nÅé°Q½×
½×¾Â¨Æ°È
ºÞ²z¤½§i
§ë¶D¤Ï¬M
·s¤â´ú¸Õ
·R ¡E ¥Í¬¡
¤½¯q§G§iÄæ
¥Í¬¡»P·P°Ê
[¦¬Âæ¹¥DÃD]
[Ãöª`¦¹¥DÃDªº·s¦^´_]
[³q¹L QQ¡BMSN ¤À¨Éµ¹ªB¤Í]
¥Ó½Ð¤Í±¡Ãì±µ
Facebook¯»µ·