0

I am trying to automate the login and then selecting date range in my office internal application to save my time using VBA excel 2013 script. I am successfully able to login and the passing date and time to the fields. After clicking on submit, a pop up dialogue box is opening.

I am not able to click on "Yes" in pop up generated in browser.

Before this point the below vba code is working fine.

Sub automaticformfilling()
Dim ie As Object
Set ie = CreateObject("internetexplorer.application")

With ie
    .Visible = True
    .navigate "http://abcd/default.asp"
Do While .busy
    DoEvents
Loop

Do While .readystate <> 4
    DoEvents
Loop
End With

Set fname = ie.document.getelementbyid("txtEmpId")
fname.Value = "abc"

Set pass = ie.document.getelementbyid("txtPassword")
pass.Value = "abc2017"

ie.document.getelementbyid("image1").Click

Set fdate1 = ie.document.getelementsbyname("fmSLADt")(0)
fdate1.Value = "12/08/2017"
Set ftime1 = ie.document.getelementsbyname("fmSLATm")(0)
ftime1.Value = "00:00:00"

ie.document.getElementsByTagName("img")(11).Click

After this part I need to click on "Yes" in pop up box to continue.

pop up image

deepaklearner
  • 151
  • 1
  • 6
  • 22
  • What are the pop up dialogue box, and internal application? Could you please share the dialogue box screenshot, and the relevant part of the webpage HTML content? – omegastripes Dec 10 '17 at 01:06
  • you can make your code less cluttered if you use this format for all four `.value` instructions `ie.document.getelementbyid("txtEmpId").Value = "abc"` – jsotola Dec 10 '17 at 01:55
  • @omegastripes I have updated the screenshot of dialogue box. Due to security reasons, I cant share the html code. – deepaklearner Dec 10 '17 at 01:57
  • you will need to figure out if the HTML of the web page contains data that can be used to determine the URL of the file that you are trying to download. – jsotola Dec 10 '17 at 02:02
  • @jsotola Its a asp.net and mysql based application. In which I am fetching data based on certain date constraints. I cant download the data directly from any link from html. Clicking on "OK" on pop up is the only option left. – deepaklearner Dec 10 '17 at 02:04
  • @deepaklearner you may try to open browser developer tools, then press OK on pop up, after file is loaded, look into logged XHR on tools network tab, and reproduce that XHR, even not using IE at all. – omegastripes Dec 10 '17 at 02:12

1 Answers1

0

There's a ton of examples from others who had the same issue.

Couple links to get you started:

ashleedawg
  • 20,365
  • 9
  • 72
  • 105