Hi I am looking for to automate current process where i take data from excel paste it in a web app once i get the results(hyper links) click on each link and take a screen print. I have tried with the below code which is not working
I am attaching the sample excel file, html code and steps
I am attaching the sample excel file, html code and steps
Code:
Option Explicit
Sub SubmitToWeb()
Dim rw As Long, ws As Worksheet
Dim IE As Object
Application.ScreenUpdating = False
Set ws = Worksheets("Sheet2")
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "https:XXXX"
Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
DoEvents
Wend
For rw = 2 To ws.Range("A1").CurrentRegion.Rows.Count
' **********************************************************************
delay 4
IE.document.getElementById("ctl00_ManagedCompaniesComboBox").Value = ws.Range("A" & rw)
delay 2
Set ElementCol = IE.document.getelementsbytagname("a")
' loop through all 'input' elements and find the one with the value "Yes"
For Each elea In ElementCol
If InStr(elea.innerhtml, "MtxResource.asmx?r=Icons/Search.png") > 0 Then
elea.Click
Exit For
End If
Next
delay 2
IE.document.getElementById("_cb_Control_ctl00_MainContent_SearchWizard_SearchCriteriaStep_SearchCriteria_StoresComboBox").Value = ws.Range("B" & rw)
' How do i click on tranasaction search buttion
delay 1
IE.document.getElementById("_cb_Control_ctl00_MainContent_SearchWizard_SearchCriteriaStep_SearchCriteria_StoresComboBox").Value = ws.Range("C" & rw)
delay 1
IE.document.getElementById("ctl00$MainContent$SearchWizard$SearchCriteriaStep$SearchCriteria$AccountLast4TextBox").Value = ws.Range("D" & rw)
delay 1
IE.document.getElementById("ctl00$MainContent$SearchWizard$SearchCriteriaStep$SearchCriteria$SearchDates_TextBox").Value = ws.Range("E" & rw)
delay 1
IE.document.getElementById("ctl00$MainContent$SearchWizard$SearchCriteriaStep$SearchCriteria$AccountLast4TextBo").Value = ws.Range("E" & rw)
delay 1
IE.document.getElementById("ctl00$MainContent$SearchWizard$SearchCriteriaStep$SearchCriteria$SearchTransactionsButton").Click
'**********************************************************************
Next rw
Application.StatusBar = "Form Submitted"
IE.Quit
Set IE = Nothing
Application.ScreenUpdating = True
End Sub
Private Sub delay(seconds As Long)
Dim endTime As Date
endTime = DateAdd("s", seconds, Now())
Do While Now() < endTime
DoEvents
Loop
End Sub