View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman[_2_] Mike Fogleman[_2_] is offline
external usenet poster
 
Posts: 206
Default Calendar Control 8.0 question

Private Sub Calendar1_AfterUpdate()
If Calendar1.Year 2011 Then Calendar1.Year = 2011
If Calendar1.Year < 2009 Then Calendar1.Year = 2009
End Sub

Mike F
"Robert Crandal" wrote in message
...
Hi again Mike. I just had another follow-up question....

Do you know if I can limit the calendar to only a couple
years?? For example, what if I wanted to limit it
to 2009 AND 2010 AND 2011?? How would the
code look then??


"Mike Fogleman" wrote in message
...

You can't change what is in the drop-down for years, but you can limit
the year to 2009 on the calendar even if they select another year from
the drop-down. Put the following code in the Worksheet code module that
your calendar is on.

Private Sub Calendar1_NewYear()
Calendar1.Year = 2009
End Sub