[µo°Ý]VBA§ì¨ú.PHP¶°ÝÃD??
- ©«¤l
- 81
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 95
- ÂI¦W
- 327
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-2-29
- ³Ì«áµn¿ý
- 2024-11-22
|
[µo°Ý]VBA§ì¨ú.PHP¶°ÝÃD??
¦U¦ì¥ý¶i
¤£¤~¦bºô¸ô¤W¬Ý¨ì¤@¬q§ì¨úÂd¶R.phpªº¸ê®Æ,ì¤å¦p¤U
Sub Macro1()
Dim i As Integer, j As Integer, k As Integer
URL$ = "http://www.gretai.org.tw/ch/stock/statistics/monthly/st42.php"
With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate URL
Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
.Document.all("input_stock_code").Value = 6121 'n¬dªº¥N½X
.Document.all(1758).Click <=====¥¨¶°°õ¦æ¨ì¦¹´N¿ù»~,½Ð°Ý³o¤@¦æ¬O¬°¦ó·N,§ä¤F«Ü¤[¬d¤£¥X¬O¦ó·N
Application.Wait Now + TimeValue("00:00:02") 'µ¥«Ý2¬í§ó·s¸ê®Æ
Set tmp = .Document.getelementsbytagname("table")(79) <==== (79)¤S¬O¦ó·N??
k = 1
Cells(k, 1) = tmp.Rows(0).innertext
Cells(k, 1).WrapText = False
For i = 1 To tmp.Rows.Length - 1
k = k + 1
For j = 0 To tmp.Rows(i).all.Length - 1
Cells(k, j + 1) = tmp.Rows(i).Cells(j).innertext
Next
Next
k = k + 1
Set tmp = .Document.getelementsbytagname("table")(82)<==== (82)¤S¬O¦ó·N??
For i = 0 To tmp.Rows.Length - 1
k = k + 1
For j = 0 To tmp.Rows(i).all.Length - 1
Cells(k, j + 1) = tmp.Rows(i).Cells(j).innertext
Next
¦]ìºô¶´N¦b¿é¤J 6121 ´N°±¦í¤F,¥¼¯àIJµoºô¶±a¥X¸ê®Æ,¬G«áÄòªº table ´NµLªk§ì¥X¼Æ¾Ú±a¤Jexecl,½Ð°Ý¥ý¶i»Ý¦p¦óקï¤~¦n..TKS!! |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
heavenweaver±z¦n¡A
¨Ï¥ÎFiddler¤u¨ãµo²{ºô§}¦³²§°Ê¡A¤w§ä¨ì°ÝÃD¤F¡AÁÂÁ±z |
|
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
heavenweaver±z¦n¡A
·Q¦V±z½Ð±Ð¡A¥ý«eª©¥»¨Ì·Ó±zªº«ü¾É¤w¥i¥¿±`¨Ï¥Î¡A¦ý¤µ¤é¾Þ§@®É¡Aµo²{excel¸ê®Æ¸ü¤£¤U¨Ó¡A¬O§_¬ÛÃö°Ñ¼Ænקï©O? ÁÂÁ±z¡C- Private Sub CommandButton4_Click()
- '«Å§iÅܼÆ
- Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
- Dim TMP As Workbook
- '²M°£Â¸ê®Æ
- Range("F66:Z200").Select
- Selection.Clear
- code = Range("A1").Value 'ªÑ²¼¥N½X
- yy = Range("H4").Value '¦~«×
- '±N¸ê®Æ¥ý¦s¦ÜcÁV
- With WinHttpReq
- .Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False
- .Open "POST", Range("I4").Value, False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .Send "stk_no=" & code & "&yy=" & yy '¶ÇªÑ²¼¥N½X¡B¦~«×°Ñ¼Æ
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Open
- oStream.Type = 1
- oStream.Write WinHttpReq.ResponseBody
- oStream.SaveToFile ("C:\" & code & "-M.csv")
- oStream.Close
- End With
-
- End Sub
-
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
¦^´_ 22# gto1208
°ÝÃD¦b³o¸Ì
'±N¸ê®Æ¥ý¦s¦ÜcÁV
With WinHttpReq
'.Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False
±z±N³o¬q«ü¥OÅܦ¨remark¡A¥¿½T¦p¤U¡G
.Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False |
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
¦^´_ 22# gto1208
½Ð°Ñ¦Ò¦Û¦æקï¡C- Sub Macro1()
- '
- ' Macro1 Macro
- ' Lu ¦b 2003/2/28 ¿ý»sªº¥¨¶°
- '
- ' §Ö³tÁä: Ctrl+a
- '
- Dim yy, stock
- yy = Application.InputBox(prompt:="½Ð¿é¤J¬d¸ß¦~¥÷(¦p2013)¡G", Title:="¤WÂd²Îp³øªí > ӪѤ릨¥æ¸ê°T")
- stock = Application.InputBox(prompt:="½Ð¿é¤JªÑ²¼¥N½X(¦p3260)¡G", Title:="¤WÂd²Îp³øªí > ӪѤ릨¥æ¸ê°T")
- If yy = "" Then yy = "2013"
- If stock = "" Then stock = "3260"
- fileIdx = "C:\MyStock\Test\st44_" & stock & ".csv"
- myURL = "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php"
- myPar = "yy=" & yy & "&stk_no=" & stock
- Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
- With WinHttpReq
- .Open "POST", myURL, False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .Send myPar
- myURL = .ResponseBody
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Open
- oStream.Type = 1
- If WinHttpReq.ResponseText = "" Then Exit Sub
- oStream.Write WinHttpReq.ResponseBody
- On Error Resume Next
- Kill fileIdx
- On Error GoTo 0
- oStream.SaveToFile fileIdx
- oStream.Close
- End With
- End Sub
½Æ»s¥N½X |
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
heavenweaver±z¦n¡A
§Ú¤w¦³½Æ»s#12ªºSub WrittenByLalalada()¨Óקï
http://www.gretai.org.tw/ch/stock/statstics/monthly/download_st44.php
¤W¦Cºô§}¦³¤GӰѼơA¤w±Nµ{¦¡§ï¼g¦p¤U¡A¦ý¦~«×ªºsend±ø¥óÁÙ¬O§ì¨ú¤£¨ì(µ{¦¡½X¦p¤U)¡AÁÂÁ±z- Private Sub CommandButton1_Click()
- '«Å§iÅܼÆ
- Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
- Dim TMP As Workbook
- '²M°£Â¸ê®Æ
- Range("A4:Z2000").Select
- Selection.Clear
- code = Range("A1").Value 'ªÑ²¼¥N½X
- yy = Range("B1").Value '¦~«×
- '±N¸ê®Æ¥ý¦s¦ÜcÁV
- With WinHttpReq
- '.Open "POST", "http://www.gretai.org.tw/ch/stock/statistics/monthly/download_st44.php", False
- .Open "POST", Range("C1").Value, False
- .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- .Send ("stk_no=" & code & "yy=" & yy)
- Set oStream = CreateObject("ADODB.Stream")
- oStream.Open
- oStream.Type = 1
- oStream.Write WinHttpReq.ResponseBody
- oStream.SaveToFile ("C:\" & code & ".csv")
- oStream.Close
- End With
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
¦^´_ 19# gto1208
¦pªG±z¬O°Ý#12ªºSub WrittenByLalalada()¡Aª½±µ½Æ»s¨ì±zªº¥¨¶°¥h°õ¦æ¡A´N·|¸õ¥X¤@Óµøµ¡¸ß°Ý¬d¸ßªÑ²¼¥N¸¹¡Aª½±µ¿é¤J´N¦n¤F¡C |
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|
- ©«¤l
- 48
- ¥DÃD
- 6
- ºëµØ
- 0
- ¿n¤À
- 60
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-8-13
- ³Ì«áµn¿ý
- 2023-2-7
|
¦^´_ 12# lalalada
·PÁ±z´£¨Ñªºvba code¡A¸g´ú¸Õ§¹¥þ¥¿±`¤S¤£»Ýn¶}±ÒIEºô¶¡AȱoÆ[¼¯¾Ç²ß¡I |
|
«Ü©êºp¡A§Ú¬O¤p¾Ç¥Í¡A¤£¯à¤U¸üÀɮסA¬OÓ¤p§¾«Ä¡I
|
|
|
|
|
- ©«¤l
- 11
- ¥DÃD
- 2
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- xp
- ³nÅ骩¥»
- 2007
- ¾\ŪÅv
- 10
- µù¥U®É¶¡
- 2011-9-17
- ³Ì«áµn¿ý
- 2017-4-24
|
¦U¦ì°ª¤â±z¦n
http://www.gretai.org.tw/ch/stock/statistics/monthly/st44.php
»P¤Wzºô¯¸¬ÛÃþ¡A¦ý¥¦¿é¤J®É¦³¤GӰѼơA¥Ø«e§ä¨ìªº°Ñ¼Æ¬O"yy"¡A·Q½Ð±Ð¤@¤U¦pªG¬O¦³stk_no»Pyy¡A¤U±sendªºµ{¦¡¸Ó¦p¦óקï©O? ÁÂÁÂ
.Send ("stk_no=" & code) |
|
|
|
|
|
|
- ©«¤l
- 9
- ¥DÃD
- 1
- ºëµØ
- 0
- ¿n¤À
- 14
- ÂI¦W
- 0
- §@·~¨t²Î
- XP
- ³nÅ骩¥»
- office2007
- ¾\ŪÅv
- 10
- ©Ê§O
- ¤k
- ¨Ó¦Û
- taiwan
- µù¥U®É¶¡
- 2013-1-17
- ³Ì«áµn¿ý
- 2013-3-20
|
ÁA¸Ñ¤F!!!
«D±`ÁÂÁÂK¤jªº¹Ï¤å¸Ñ»¡~
³sdata code ³£¸Ñ»¡¤F~¯uªº«D±`²M·¡!! |
|
Nicole
|
|
|
|
|