• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA entering date dd.mm.yy format in webpage textbox

Iam working on a project ''Automation IE'' need help on the same.

I am trying to spool one excel report from website by giving From date and To Date are as inputs iam able to give enter dates with my code but after clicking on export button dates are disappearing..

Below is the HTML source code for FromDate

Code:
<input name="ctl00$ContentPlaceHolder1$txt_0" type="text" maxlength="10" id="txt_0" tabindex="1"class="watermarked" width="200px" selectionstart="txt_0" onchange="isDate2(this)" style="width: 200px;Height:20px;" autocomplete="off">
Below is the HTML source code for ToDate
Code:
<input name="ctl00$ContentPlaceHolder1$txt_1" type="text" maxlength="10" id="txt_1" tabindex="2"class="watermarked" width="200px" selectionstart="txt_1" onchange="isDate2(this)" style="width: 200px;Height:20px;" autocomplete="off">

Below is the HTML source code for Export Report Button
Code:
<input type="submit" name="ctl00$ContentPlaceHolder1$btnExportXLS" value="Export Report" onclick="if(!Validate()) return false;" id="btnExportXLS" tabindex="3"class="button blue" onmousedown="return isTxtwithfocus(event, this)" style="width:101px;float: none; margin-top: 2px;">

And this is my code

Code:
Sub User_Wise_Productivity()

Dim From_Date AsStringDim To_Date AsString

From_Date = InputBox("Enter report From date in (Ex: DD.MM.yyy)format")
To_Date = InputBox("Enter report To date in (Ex: DD.MM.yyy)format")

Set browser = CreateObject("internetexplorer.application")
browser.Visible =True
browser.navigate ("My URL")

Do
DoEvents
LoopUntil browser.readyState =4

browser.document.getElementById("txtUserName").Value ="Myid"
browser.document.getElementById("txtPassword").Value =“Mypsw”

browser.document.getElementById("selFund").selectedIndex ="21"
browser.document.getElementById("btnSubmit").Click

Do
DoEvents
LoopUntil browser.readyState <>4

browser.navigate ("MY URL Page2")

Do
DoEvents
LoopUntil browser.readyState <>4

Dim reprt AsString
reprt ="11"

With browserSet Post =.document.getElementById("ddlrptlist")ForEach elem In Post.getElementsByTagName("option")If elem.Value = reprt Then elem.Selected =True:ExitForNext elem

.document.getElementById("ddlrptlist").FireEvent ("onchange")

EndWith

Do
DoEvents
LoopUntil browser.readyState <>4

browser.document.getElementById("txt_0").Value = From_Date
browser.document.getElementById("txt_1").Value = To_Date

Application.Wait (Now + TimeValue("0:00:02"))

browser.document.getElementById("btnExportXLS").Focus
browser.document.getElementById("btnExportXLS").Click

EndSub

Any help greatly appreciated. thanks in advance.

Cross Post: https://stackoverflow.com/questions/53492845/vba-entering-date-dd-mm-yy-format-in-webpage-textbox
 
Back
Top