Be seen. Boost your question’s priority for more expert views and faster solutions
'Testing Experts Stuff
Dim myValue2$
myValue2 = Format(whichDay, "mm/dd/yyyy")
Dim clipboard As New MSForms.DataObject
clipboard.SetText myValue2
clipboard.PutInClipboard 'put our text into the clipboard
'Call the paste event on the control
Set anElem = htmlDoc.getElementById("ctl00_ContentPlaceHolder1_DatePick2_StartDatePicker_dateInput_text")
anElem.focus
anElem.document.selection.createRange.execCommand "Paste"
'Move focus to another control to see if the value stays (it doesn't)
Set anElem = htmlDoc.getElementById("ctl00_ContentPlaceHolder1_DatePick2_StartDatePicker_popupButton")
anElem.focus
'Here is the code that actually successfully sets it
Set anElem = htmlDoc.getElementById("ctl00_ContentPlaceHolder1_DatePick2_StartDatePicker_dateInput_text")
clipboard.SetText "09/20/2011"
clipboard.PutInClipboard
anElem.focus
anElem.document.selection.createRange.execCommand "Delete"
anElem.document.selection.createRange.execCommand "Paste"
'Set this other control that's invisible that we found that goes with this one
Set anElem = htmlDoc.getElementById("ctl00_ContentPlaceHolder1_DatePick2_StartDatePicker_dateInput")
anElem.value = "2011-09-20-00-00-00"
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Join the community of 500,000 technology professionals and ask your questions.