Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Restricting use of Calendar Control

I asked this question a couple of days ago and got a response (but the
response while it would work, did not fit into how I wanted to set up my
form) so I thought I would try one more time:

Is there any way to lock a Calendar control in such a way that someone could
only select a Thursday? Ideally the last Thursday of the month.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Restricting use of Calendar Control

Worked out my own solution. My not look pretty, but it works:

Private Sub Calendar1_Click()

Dim MyDate, MyWeekDay
MyDate = Calendar1.Value ' Assign a date.

MyWeekDay = Weekday(MyDate)

If MyWeekDay = 5 Then

Exit Sub

End If
Unload Calendar
WrongDay.Show
End Sub


"Patrick Simonds" wrote in message
...
I asked this question a couple of days ago and got a response (but the
response while it would work, did not fit into how I wanted to set up my
form) so I thought I would try one more time:

Is there any way to lock a Calendar control in such a way that someone
could only select a Thursday? Ideally the last Thursday of the month.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Restricting use of Calendar Control

Patrick,
This any better ?
Private Sub Calendar1_Click()
With Calendar1
'Is it any Thursday
If Weekday(.Value) = vbThursday Then
'Is it the last Thursday
If Month(.Value) = Month(.Value + 7) Then
'Same month so cannot be last Thursday
MsgBox "Not last Thursday in this month"
Else
MsgBox "Date OK"
End If
Else
MsgBox "Not a Thurday"
End If
End With
End Sub

NickHK

"Patrick Simonds" wrote in message
...
Worked out my own solution. My not look pretty, but it works:

Private Sub Calendar1_Click()

Dim MyDate, MyWeekDay
MyDate = Calendar1.Value ' Assign a date.

MyWeekDay = Weekday(MyDate)

If MyWeekDay = 5 Then

Exit Sub

End If
Unload Calendar
WrongDay.Show
End Sub


"Patrick Simonds" wrote in message
...
I asked this question a couple of days ago and got a response (but the
response while it would work, did not fit into how I wanted to set up my
form) so I thought I would try one more time:

Is there any way to lock a Calendar control in such a way that someone
could only select a Thursday? Ideally the last Thursday of the month.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Restricting use of Calendar Control

Another approach would be to use a list box with only the last
Thursday of each month listed.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Patrick Simonds"
wrote in message
...
I asked this question a couple of days ago and got a response (but the
response while it would work, did not fit into how I wanted to set up my
form) so I thought I would try one more time:

Is there any way to lock a Calendar control in such a way that someone could
only select a Thursday? Ideally the last Thursday of the month.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Restricting use of Calendar Control

Patrick,
Jim's solution is probably better.
I find it frustrating when I am apparently given the choice of all these
options, but for some unknown reason cannot choose them.
Why give the user all the days of the month if only a single day is valid ?

NickHK

"Jim Cone" wrote in message
...
Another approach would be to use a list box with only the last
Thursday of each month listed.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Patrick Simonds"
wrote in message
...
I asked this question a couple of days ago and got a response (but the
response while it would work, did not fit into how I wanted to set up my
form) so I thought I would try one more time:

Is there any way to lock a Calendar control in such a way that someone

could
only select a Thursday? Ideally the last Thursday of the month.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Control disappeared problem - specifically, the Calendar Control JMMach[_2_] Excel Programming 0 December 16th 05 01:53 AM
calendar control 10.0 timmulla Excel Programming 0 November 30th 05 08:52 PM
calendar control msnews.microsoft.com[_6_] Excel Programming 1 October 21st 04 04:20 PM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM
Calendar Control Kelly Excel Programming 3 February 19th 04 09:36 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"