Calendar control form? (Saving the value)
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Calendar control form? (Saving the value)

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    117
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    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. #2
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-07 14:42, Todd_M wrote:
    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


    You can do a few things. Among them:

    -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. #3
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    Chippenham, UK
    Posts
    136
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    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

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com