Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Location
    Upstate NY, New York, USA
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Set Calendar Control to Current Date (VBA Word 97)

    My user form has a Calendar control called "CalendarControl". I want the current date to get focus when the form is loaded. I know this sounds like a simple thing but I can't for the life of me get it to work. I thought I should just use:

    CalendarControl.Value = Date

    The value under properties keeps reverting back to the date I wrote the code...any help for this novice would be appreciated since it seems EVERYTHING I find on the internet has to do with Access, not Word and although similar, what works for Access doesn't necessarily work for Word.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Try dropping the Value property and just set the calendar control equal to Date. Since the control isn't an Access control at all, this should work in Word as well.
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Location
    Upstate NY, New York, USA
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Thanks Charlotte -- but that doesn't work for me either...

  4. #4
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Joanne,

    Try "Now" rather than "Date"(?)

    Gary

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Location
    Upstate NY, New York, USA
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    No luck... but thank you.

  6. #6
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Where are you putting that code? It should be in the form initilize event routine.
    Legare Coleman

  7. #7
    Star Lounger
    Join Date
    Jan 2001
    Location
    Upstate NY, New York, USA
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Thanks to all who have made suggestions. I figured out the error of my ways.... and am absolutely mortified to admit that I had neglected to include the form name prior to the control...

    Hence:

    frmCalendar.CalendarControl = Date

    Must have been a rougher weekend than I thought. <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Using Option Explicit will find those kind of problems quickly.
    Legare Coleman

  9. #9
    Star Lounger
    Join Date
    Jan 2001
    Location
    Upstate NY, New York, USA
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Set Calendar Control to Current Date (VBA Word 97)

    Thank you Legare. I shall use that statement unfailingly in the future <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

Posting Permissions

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