VBA to change date in Data picker on web page

dionysus_83

New Member
Joined
Feb 24, 2016
Messages
30
Code:
[COLOR=#333333]Sub getdata()[/COLOR]<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">
Dim ie As New InternetExplorer
ie.Visible = True
ie.navigate "https://app.scheduleonce.com/Home.aspx"

With ie
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With
Dim doc As HTMLDocument
Set doc = ie.document

Set dfrom = doc.getElementById("TxtDateFrom")
dfrom.Value = "Dec 01, 2017"
Set dto = doc.getElementById("TxtDateTo")
dto.Value = "Jan 31, 2018"

Set btn = doc.getElementsByTagName("input")(12)
btn.Click


With ie
While .Busy Or .readyState <> READYSTATE_COMPLETE: DoEvents: Wend
End With

Dim mt As String
For IDn = 1 To 100
mt = doc.getElementById("rowID_" & IDn).innerText
Sheets(1).Range("a" & IDn) = mt
Next IDn </code>[COLOR=#333333]End Sub[/COLOR]

VBA open page and it does change dates to one I've set but doesn't apply data range to generate report. I've noticed later that DateFrom is readonly. How can I change DateFrom and DateTo with VBA and execute date change to generate report?

And here is troublesome HTML :) :

HTML:
 <div id="datediv" style=""><div class="filderItems"><div class="homeFilters"><div class="boldText">From:<input id="TxtDateFrom" style="" class="calendertbs" *******="OpenDatePicker('CalDivFrom', 'TxtDateFrom'); blur(); return false;"readonly="readonly" type="text" value="" /><span *******="OpenDatePicker('CalDivFrom', 'TxtDateFrom');  return false;" style="cursor: pointer"><img id="CalDivFrom" src="//cdn.scheduleonce.com/images/calender_icon.jpg" alt="" /></span></div></div></div><div class="filderItems"><div class="homeFilters ml10"><div class="boldText">To:<input id="TxtDateTo" style="" class="calendertbs" *******="OpenDatePicker('CalDivTo', 'TxtDateTo'); blur(); return false;"readonly="readonly" type="text" value="" /><span *******="OpenDatePicker('CalDivTo', 'TxtDateTo');  return false;" style="cursor: pointer"><img id="CalDivTo" src="//cdn.scheduleonce.com/images/calender_icon.jpg" alt="" /></span></div></div></div><div class="filderItems filterBtn" style=""><input type="button" value="Go" class="btn" style="" *******="DateFilter();" /></div>
</div></div></div>
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Untested but you could try adding the following after you've set the values:

Code:
dfrom.fireEvent("onblur")
dto.fireEvent("onblur")

WBD
 
Upvote 0
Hi. OK. It was just a thought. It's a tricky one to solve because I don't have an account there so I couldn't really investigate in detail. I saw that the ******* events then forced the blur() so I thought it was worth a shot.

WBD
 
Upvote 0
Hm... Ill try that, but not sure how to implement. That web page is not actually opening a new page for report. It is generated as web app.
 
Upvote 0
As I said, I don't have a membership of that site so it's hard to help. You could try using a Browser automation solution such as Kantu, iMacros or Selenium.

WBD
 
Upvote 0
On the end I found different solution. Since data from Schedulonce is connected to Infusionsoft, I used their API to generate REPORT. Absolutely same method and same VBA code I used and it worked like a charm! I passed value of ID and it was accepted. Most importantly, I have what I need but still a bit bothered about this case because I could encounter something similar in future! Is it possible it is because of this
Code:
[COLOR=#FF8000]; return false;"readonly="readonly"[/COLOR]
?
 
Upvote 0
I am also dealing with a date picker on the website I am using. I have no code because I have no idea how to code it. I can provide the html I am trying to code.
here is the HTML.

"<input tabindex="7" class="DatePickFont igte_EditInContainer" accesskey="B" style="width: 97%; height: 100%; float: left; -ms-ime-mode: disabled;" type="text" data-ig="x:1491459835.0:mkr:3" mkr="3">"

I am trying to put in a date from my excel spreadsheet using vba excel 2010.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top