phanminhphuong
Thành viên hoạt động
- Tham gia
- 26/7/13
- Bài viết
- 127
- Được thích
- 68
PHP:
Dim oIE As Object ' InternetExplorer.Application
Dim sURL As String
Dim btnInput As Object ' MSHTML.HTMLInputElement
Dim ieDoc As Object 'MSHTML.HTMLDocument
Dim ElementCol As Object
Set oIE = CreateObject("InternetExplorer.Application")
Set ieDoc = oIE.Document
Mã:
sURL = "http://diachigigido.com"
If oIE.LocationURL = sURL Then 'Kie^?m tra URL la^`n 1
Select Case Application.Assistant.DoAlert("NOTICE", [U74].Value, msoAlertButtonOKCancel, msoAlertIconInfo, msoAlertDefaultFirst, msoAlertCancelFirst, False) 'Thông báo = tiếng việt UNICODE nội dung ô U74
Case vbOK
Set ElementCol = ieDoc.getElementsByTagName("a")
For Each btnInput In ElementCol
If btnInput.Title = "Add Subject" Then
btnInput.Click 'An button tao moi
Exit For
End If
Next
Do While oIE.Busy Or oIE.ReadyState <> 4: DoEvents: Loop
If oIE.LocationURL = sURL Then 'Nếu địa chỉ trang web ko đổi (Ấn button nhưng ko thực hiện được) - Kie^?m tra URL la^`n 2
Select Case Application.Assistant.DoAlert("NOTICE", [U74].Value, msoAlertButtonOKCancel, msoAlertIconInfo, msoAlertDefaultFirst, msoAlertCancelFirst, False) 'Lại thông báo nội dung ô U74
Case vbOK
Set ElementCol = ieDoc.getElementsByTagName("a")
For Each btnInput In ElementCol
If btnInput.Title = "Add Subject" Then
btnInput.Click 'An button tao moi
Exit For
End If
Next
Do While oIE.Busy Or oIE.ReadyState <> 4: DoEvents: Loop
If oIE.LocationURL = sURL Then 'Laji kiểm tra URL lần thứ 3
Select Case Application.Assistant.DoAlert("NOTICE", [U74].Value, msoAlertButtonOKCancel, msoAlertIconInfo, msoAlertDefaultFirst, msoAlertCancelFirst, False)
End Select
Application.Visible = True
Exit Sub
End If
Case vbCancel
Application.Visible = True
Exit Sub
End Select
End If
Case vbCancel
Application.Visible = True
Exit Sub
End Select
End If
Lần chỉnh sửa cuối: