- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¥»©«³Ì«á¥Ñ GBKEE ©ó 2016-6-12 15:02 ½s¿è
¦^´_ 16# c_c_lai
url ¸Ì¬°¦ó§Ú¤@ª½§ì¤£¨ì¥¿½Tªº selectType ¹ïÀ³È¡H
ºô¶ªº«Ø¸m§Ú¨S¤Jªù,©Ò¥H§Ú¤]¦bºN¯Á¤¤
.getElementsByName: getElements ½Æ¼Æ-> ª«¥óªº¶°¦X
.getElementsBytagName: getElements ½Æ¼Æ-> ª«¥óªº¶°¦X
.ALL.tags: tags ½Æ¼Æ-> ª«¥óªº¶°¦X
.getElementById : getElement ³æ¼Æ ->³æ¤@ªºª«¥ó- Set xTable = oHtmldoc.ALL.tags("TABLE")
- Stop
- '¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
- Set xTable = oHtmldoc.ALL.tags("TABLE")(0)
- Stop
- '¦A¦¸¬Ý¬Ý°Ï°ìÅܼƵøµ¡ xTable ªº¤º®e
- MsgBox xTable.INNERTEXT
½Æ»s¥N½X ªþÀɤ¤¦³³\¦h¬Û¦Pªºµ{¦¡½X.,,,,,,,,,,,- TVal = Array("MS", "", "0049", "0099P", "019919T", "0999", "0999P", "01", "02", "03", _
- "04", "05", "06", "07", "21", "22", "08", "09", "10", _
- "11", "12", "13", "24", "25", "26", "27", "28", "29", _
- "30", "31", "14", "15", "16", "17", "18", "23", "9299", "19", "20", "CB")
- '**************************
- If .ComboBox1.Value = "Select Name" Then
- MsgBox ("±z©|¥¼¿ï¾Ü¡u²£·~Ãþ§O¡v¡A½Ð©ó" & vbCrLf & "½T»{«á¦A¦¸ÂI¿ï¡y¶}±Òºô¶¡z¡A" & vbCrLf & "ÁÂÁ±z¡I")
- Exit Sub
- End If
- For cts = 0 To UBound(lst)
- If lst(cts) = .[D1] Then select2 = TVal(cts): Exit For
- Next cts
½Æ»s¥N½X ¥i¥H¾ã¦X¤@¤U- Option Explicit
- Const MyUrl = "http://www.twse.com.tw/ch/trading/exchange/MI_MARGN/MI_MARGN.php"
- Private Sub Workbook_Open()
- Dim oHtmldoc, op, cts
- Set oHtmldoc = CreateObject("htmlfile")
- With CreateObject("msxml2.xmlhttp")
- .Open "Get", MyUrl, False
- .Send
- Do While .Status <> 200 Or .readyState <> 4: DoEvents: Loop
- oHtmldoc.write .responseText
- End With
- Set op = oHtmldoc.all.tags("select")("selectType")
- With Sheets("Á`ªí").ComboBox1
- .Clear
- For cts = 0 To op.Length - 1
- .AddItem '²M³æ¤è¶ô©Î¤U©Ô¦¡²M³æ¤è¶ô¤¤¥[¤J¤@Ó¶µ¥Ø
- .List(.ListCount - 1, 0) = op(cts).Text ' ²Ä1Äæ,³Ì¦h9Äæ
- .List(.ListCount - 1, 1) = op(cts).Value ' ²Ä2Äæ,³Ì¦h9Äæ
- Next
- .Value = "Select Name" '.List(0) '0: «H¥Î¥æ©ö²Îp, 1:¥þ³¡,2: «Ê³¬¦¡°òª÷......
- End With
- End Sub
½Æ»s¥N½X- Private Function Select_Name() As Integer
- With Sheets("Á`ªí").ComboBox1
- If .ListIndex = -1 Then MsgBox ("±z©|¥¼¿ï¾Ü¡u²£·~Ãþ§O¡v¡A½Ð©ó" & vbCrLf & "½T»{«á¦A¦¸ÂI¿ï¡y¶}±Òºô¶¡z¡A" & vbCrLf & "ÁÂÁ±z¡I")
- Select_Name = .ListIndex
- End With
- End Function
½Æ»s¥N½X- Sub ¿Ä¸ê¿Ä¨é2()
- Dim qdate As String, select2 As String
- 'Dim TVal(), cts As Integer
- If Select_Name = -1 Then
- Exit Sub
- Else
- With Sheets("Á`ªí")
- qdate = Format(.[B1], "EE/MM/DD")
- With .ComboBox1
- select2 = .List(.ListIndex, 1)
- End With
- End With
- End If
- With Sheets("¿Ä¸ê_¿Ä¨é")
- .Select
- .Cells.Clear
- End With
½Æ»s¥N½X |
|