DatePickers on Excel MultiPage Controls

I’ve known this for a little while but I thought it worth posting here. You cannot get or assign the value of a DatePicker control on a MultiPage control if you’re on a different page of the MultiPage control. So if you’ve got a 5 page MultiPage control and the DatePicker Control is on page 1 of the MultiPage then this won’t work (and will indeed give an error):

'dtPicker is on MultiPage1 page 1, 

And this wont work either:

  Dim datTmp as Date
'dtPicker is on MultiPage1 page 1, 
 'this just sets datTmp to todays date and ignores the actual dtPicker value

So if you want to set or get the value of a DatePicker on a MultiPage control you need to be careful which page of the MultiPage is selected. You need to do something like this.

 'save the page we are on now
  iCurrentPage = Me.MultiPage1.Value
  'change to the page the DatePicker is on and set the value
  Me.MultiPage1.Value = 4
  Me.dtPicker.Value = Now
  'go back to the original page
  Me.MultiPage1.Value = iCurrentPage
This entry was posted in Software on by .

About markn

Mark is the owner and founder of Timesheets MTS Software, an mISV that develops and markets employee timesheet and time clock software. He's also a mechanical engineer, father of four, and a lifelong lover of gadgets.