![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 117
|
Hi-
My question concerns how to save the date that was selected by a user using the calendar control form (lets say 7 march 2002).When the user exits the workbook, then reenters the workbook, the calander face resets it self to Dec of 2001. I am looking for a code to write that will have the calendar face stay on march of 2002(or the last date selected) when the workbook is reopened. This can be annoying becouse this workbook is used a few times a day, and each time we open the book, we have to reset the month and the year! Thankyou if you can suggest something...Todd |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
-Place the last date selected somewhere in your workbook - a hidden sheet, maybe. -Better yet, make a custom property and use that. For example, when the form opens Calendar1.Value = ActiveWorkbook.CustomDocumentProperties("LastDate").Value And when the user selects a date, add something like this: ActiveWorkbook.CustomDocumentProperties("LastDate").Value = Calendar1.Value Hope this helps, Russell |
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
The easiest way to add a custom document property is to go to File-Properties, then click on the Custom tab. Name the property (in my example, "LastDate" - no quotes), select Date for the type of property, and then put in a value. Then click Add.
-rh |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Feb 2002
Location: Chippenham, UK
Posts: 136
|
Load the userform containing the control (before using show). You can do this using the open event for the workbook. Then use
Calendar1.Value = Date This will initialise the calendar to todays date on opening.
__________________
Regards, Gary Hewitt-Long |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|