ibnerafiq
05-09-2008, 03:58 AM
Hi,
I have a webbased software(Intranet) and I want to automatically fill its text boxes and command button.I have two issues at this time.
1-How can I select a 2nd option in a listbox
2-And how can I click process or cancel button on a message box
Here is my code:
Sub IECompletion()
While IE.readyState <> 4
Application.Wait Now + TimeSerial(0, 0, 1)
Wend
End Sub
Sub Datamanipulation()
Application.ScreenUpdating = False
Dim doc4 As HTMLDocument
Dim tblBlock As HTMLTable
IESelection
Dim CallsBlock As HTMLCheckbox
Dim InOp As HTMLOptionElement
'IECompletion
Set Doc = IE.Document
Set myIframe = Doc.getElementById("WorkFrame")
Set doc2 = myIframe.contentWindow.Document
Set cFrame = doc2.getElementById("CustomerInfo")
Set doc3 = cFrame.contentWindow.Document
doc3.getElementById("btnNumberSearch").Click
IECompletion
doc3.getElementById("tfcode").innerText = "51"
doc3.getElementById("tfNumber").innerText = "8260395"
IECompletion
doc3.getElementById("btnFindNumber").Click
Application.Wait Now + TimeSerial(0, 0, 2)
Set tblCus = doc3.all.Item("Table2", 1)
IECompletion
'Here is the list box ID
Set InOp = doc3.getElementById("sTD")
'MsgBox Trim("InnerText is" & tblCus.Rows(2).Cells(1).innerText)
If tblCus.Rows(2).Cells(1) = " None" Then
doc2.Focus
doc2.getElementById("ASPnetMenu1i28").Click
IECompletion
Set tblBlock = doc3.getElementById("TableNewBlockList")
IECompletion
doc3.getElementById("cb_a_b5").Checked = True
doc3.getElementById("cmdAdd").Click
'MsgBox tblBlock.Rows(5).Cells(1).ID 'End If
IECompletion
doc3.getElementById("cmdProcess").Click
IECompletion
'And here is the msgbox appear and I want to click its yes option.
End If
End Sub
I have a webbased software(Intranet) and I want to automatically fill its text boxes and command button.I have two issues at this time.
1-How can I select a 2nd option in a listbox
2-And how can I click process or cancel button on a message box
Here is my code:
Sub IECompletion()
While IE.readyState <> 4
Application.Wait Now + TimeSerial(0, 0, 1)
Wend
End Sub
Sub Datamanipulation()
Application.ScreenUpdating = False
Dim doc4 As HTMLDocument
Dim tblBlock As HTMLTable
IESelection
Dim CallsBlock As HTMLCheckbox
Dim InOp As HTMLOptionElement
'IECompletion
Set Doc = IE.Document
Set myIframe = Doc.getElementById("WorkFrame")
Set doc2 = myIframe.contentWindow.Document
Set cFrame = doc2.getElementById("CustomerInfo")
Set doc3 = cFrame.contentWindow.Document
doc3.getElementById("btnNumberSearch").Click
IECompletion
doc3.getElementById("tfcode").innerText = "51"
doc3.getElementById("tfNumber").innerText = "8260395"
IECompletion
doc3.getElementById("btnFindNumber").Click
Application.Wait Now + TimeSerial(0, 0, 2)
Set tblCus = doc3.all.Item("Table2", 1)
IECompletion
'Here is the list box ID
Set InOp = doc3.getElementById("sTD")
'MsgBox Trim("InnerText is" & tblCus.Rows(2).Cells(1).innerText)
If tblCus.Rows(2).Cells(1) = " None" Then
doc2.Focus
doc2.getElementById("ASPnetMenu1i28").Click
IECompletion
Set tblBlock = doc3.getElementById("TableNewBlockList")
IECompletion
doc3.getElementById("cb_a_b5").Checked = True
doc3.getElementById("cmdAdd").Click
'MsgBox tblBlock.Rows(5).Cells(1).ID 'End If
IECompletion
doc3.getElementById("cmdProcess").Click
IECompletion
'And here is the msgbox appear and I want to click its yes option.
End If
End Sub