- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
4#
發表於 2014-8-18 20:46
| 只看該作者
回復 3# av8d - Option Explicit
- Dim FormDLL As String
- Sub Ie_document()
- Dim URL As String, Ie As Object, A As Object, i
- ' URL = "D:\原始檔.htm"
- URL = "https://cas.tycg.gov.tw/casserver/login?service=http%3A%2F%2Fe.tycg.gov.tw%2Fapp%2Fportal%2Flogin"
- Set Ie = CreateObject("InternetExplorer.Application")
- With Ie
- .Navigate URL
- .Visible = True
- Do While .Busy Or .readyState <> 4: Loop
- Stop '網頁上輸入 帳號,密碼 後繼續程式
- On Error Resume Next
- Set A = .document.ALL
- For i = 0 To A.Length - 1
- Cells(i + 1, "A") = A(i).TAGNAME
- Cells(i + 1, "B") = A(i).ID
- Cells(i + 1, "C") = A(i).Name
- Cells(i + 1, "D") = A(i).Value
- Cells(i + 1, "E") = A(i).INNERTEXT
- Cells(i + 1, "F") = A(i).Type
- Next
- '到工作表上看 [帳號,密碼]在哪一個元素上
- End With
- End Sub
- Sub Ie()
- Dim URL As String, Ie As Object, i
- 'URL = "D:\原始檔.htm"
- URL = "https://cas.tycg.gov.tw/casserver/login?service=http%3A%2F%2Fe.tycg.gov.tw%2Fapp%2Fportal%2Flogin"
-
- Set Ie = CreateObject("InternetExplorer.Application")
- With Ie
- .Navigate URL
- .Visible = True
- Do While .Busy Or .readyState <> 4: Loop
- With .document.getElementsByTagName("input")
- .Item("pincode").Value = "pincode"
- .Item("pinpassword").Value = "pinpassword"
-
- '****************
- .Item("username").Value = "帳AAA號"
- For i = 0 To .Length - 1
- If .Item(i).ID = "password" And .Item(i).Name = "password" Then
- '大小寫有分別
- .Item(i).Value = "TEST"
- End If
- Next
- '********************
- .Item("pinbutton").Click '這裡我無法測試
- End With
- End With
-
- End Sub
複製代碼 |
|