VBA to press button on website

Hawk3116

New Member
Joined
Jun 16, 2014
Messages
15
I am trying to make to put a date into a field on a website and I have 2 options on how to do this and I can't seem to make either one work.

1. I can put it into the field directly which doesn't seem to be working

HTML:
 <span class="gwt-InlineLabel WCRF WBRF" style="min-width: 14.5px;" data-automation-id="dateSectionMonth" data-automation-activeDateTimeSection="false">MM</span>

I am using the code
Code:
For Each l In ie.document.getElementsByTagName("span")  If l.className Like "gwt-InlineLabel WCRF WBRF" Thenl.Value = "10" End If  Next


I have also tried changing the inner text which makes it look like it works but when I submit it the page it won't recognized that it is anything but the default MM.

Option 2
I have also tried clicking a pop up calender and get the date that way. Now I can click the calender but I can't figure out how to click the right arrow to switch the months.

HTML:
<div tabindex="0" class="datePickerPreviousButton datePickerPreviousButton-up" role="button" aria-pressed="false">
<input tabindex="-1" role="presentation" style="width: 1px; height: 1px; overflow: hidden; position absolute; z-index: -1; opacity: 0;" type="text">
<i class="WHDF" role="presentation" data-icon-id="" data-icon-rtl-id="" data-automation-id="icon"></i><div class="html-face">‹</div></div>


The code I have tried is
Code:
For Each l In ie.document.getElementsByTagName("div")  If l.className Like "datePickerPreviousButton datePickerPreviousButton-up" Then l.click  End If  Next
]

Any help would be greatly appreciated as I have spent way to much time trying to figure this out.
 
Last edited:

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,215,404
Messages
6,124,715
Members
449,184
Latest member
COrmerod

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