ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DTPicker control - Initial date (https://www.excelbanter.com/excel-programming/442591-dtpicker-control-initial-date.html)

René[_2_]

DTPicker control - Initial date
 
I added a date picker (DTPicker1) control on November 30, 2009 in one of my
..xlt template.

At the initial Workbook_Open level of this template, the value of the
"LinkedCell" of the DTPicker1 control is set to "YYYY-MM-DD". Here is the
code:
Sheets("MRF Form").Range("FundingDate") = "YYYY-MM-DD".

My problem is that the first time (and only the first time) a user click on
the down arrow of DTPicker1, the calendar shown is always November 2009 with
the number 30 highlighted.

I would like that the default date of the control would be set to the
current date so the default calendar shown would be the current month date.
How can I fix this issue.

I added the following code at the sheet level but it does not work properly
for the first time.

Private Sub DTPicker1_DropDown()
If Not IsDate(Range("FundingDate").Value) Then DTPicker1.Value = Date
End Sub


Note: I am currently using Excel 2003.



René[_2_]

DTPicker control - Initial date
 
I found the problem. The control was not well initialized at the opening of
the template.
Now the code look like the following line in the Workbook_Open procedu
Sheets("MRF Form").DTPicker1.Value = Date
Sheets("MRF Form").Range("FundingDate") = "YYYY-MM-DD".

Case closed.

"René" wrote:

I added a date picker (DTPicker1) control on November 30, 2009 in one of my
.xlt template.

At the initial Workbook_Open level of this template, the value of the
"LinkedCell" of the DTPicker1 control is set to "YYYY-MM-DD". Here is the
code:
Sheets("MRF Form").Range("FundingDate") = "YYYY-MM-DD".

My problem is that the first time (and only the first time) a user click on
the down arrow of DTPicker1, the calendar shown is always November 2009 with
the number 30 highlighted.

I would like that the default date of the control would be set to the
current date so the default calendar shown would be the current month date.
How can I fix this issue.

I added the following code at the sheet level but it does not work properly
for the first time.

Private Sub DTPicker1_DropDown()
If Not IsDate(Range("FundingDate").Value) Then DTPicker1.Value = Date
End Sub


Note: I am currently using Excel 2003.




All times are GMT +1. The time now is 12:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com