- ©«¤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
        
|
¦^´_ 7# die78325
§ñÃö³oºô¶¦w¥þ,§Ú¤]µLªk¬Ý¨ìºô¶´À§A×¥¿
¥i°Ñ¦Ò³oºô¶ªº¼gªk- Sub °ê»Ú³f¬d¸ß()
- Dim i As Integer, s As Integer, k As Integer, n, kn, j, xi
- Dim Element, ²Î½s As String, ie As Object, sh As Worksheet
- ²Î½s = 16834268
- Set ie = CreateObject("InternetExplorer.Application")
- With ie
- .Visible = True
- .Navigate "http://public-cpd.mtnet.gov.tw/pub_newquery/query_national.asp"
- Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
- With .Document
- Set Element = .getElementsByName("sel") '¬d¸ßÃþ§O
- '0: ú¯Ç³æ¸¹
- '1: ³ø³æ¸¹½X
- '2: ¤½¥q²Î½s(¨¤ÀÃÒ¦r¸¹): "id"[¤½¥q²Î½s] ,"sel01" [¿ï¶µ] , "portcode"[´ä§O]
- Element(2).Click '2: ¤½¥q²Î½s(¨¤ÀÃÒ¦r¸¹)
- Set Element = .getElementsByName("id") '[¿ï¶µ]
- Element(0).Value = ²Î½s
- .getElementsByName("sel01")(0).Value = 2
- '[¿ï¶µ]:<select name="sel01">
- 'value='1'>¤í¶O²M³æ ' value='2' ©Ò¦³Ãº¯Ç³æ
- .getElementsByName("portcode")(0).Value = "TWKEL"
- '[´ä§O]: <select name="portcode">
- 'value='-'>©Ò¦³´ä
- 'value='TWKEL' ->°ò¶©´ä
- 'value='TWKHH' ->°ª¶¯´ä
- 'value='TWTXG' ->¥x¤¤´ä
- 'value='TWHUN' ->ªá½¬´ä
- 'value='TWTPE' ->¥x¥_´ä
- 'value='TWSUO' ->Ĭ¿D´ä
- 'value='TWANP' ->¦w¥´ä
- 'value='TWBDA' ->¥¬³U´ä
- For i = 0 To .getelementsbytagname("INPUT").Length - 1 '´M§ä[¶}©l¬d¸ß]«öÁä
- If .getelementsbytagname("INPUT")(i).Value = "¶}©l¬d¸ß" Then
- .getelementsbytagname("INPUT")(i).Click '«ö¤U [¶}©l¬d¸ß] «öÁä
- Exit For
- End If
- Next
- Do While ie.Busy Or ie.ReadyState <> 4: DoEvents: Loop
- Set sh = ActiveSheet '«ü©w¤u§@ªí: ¼g¤J¸ê®Æ
- ActiveSheet.UsedRange.Offset(1).Clear
- For i = 1 To .getelementsbytagname("table")(0).Rows.Length - 1 '¼g¤J¸ê®Æ
- k = k + 1
- For j = 0 To 13
- sh.Cells(k, j + 1) = .getelementsbytagname("table")(0).Rows(i).Cells(j).innertext
- If i = .getelementsbytagname("table")(0).Rows.Length - 1 Then Exit For '³Ì«á¤@¦CÅã¥Ü¸ê®Æ¼Æ
- Next
- Next
- sh.Columns.AutoFit
- End With
- .Quit
- End With
- Set ie = Nothing
- End Sub
½Æ»s¥N½X ***********
©Î¥i°Ñ¦Ò³o°µªk
*********** |
|