Calendar control -2003/11.0 weirdness

musclpete

New Member
Joined
May 7, 2009
Messages
1
I have a VBA form that I added 2 text boxes to determine a date range. In those boxes, it calls a calendar control that's initially invisible. Here's the code:

Dim sWhere As String
Private Sub tbFrom_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
cal1.Visible = True
sWhere = "From"
End Sub

Private Sub tbThru_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
cal1.Visible = True
sWhere = "Thru"
End Sub

Private Sub cal1_Click()
If sWhere = "From" Then
tbFrom.Text = cal1.Value
Else
tbThru.Text = cal1.Value
End If
sWhere = ""
cal1.Visible = False
End Sub

What's not happening is when I 'mouse down' over either of the text boxes, the calendar doesn't come up. If I click in the area where the calendar control is located, then it selects a date even though I can't see what date I'm selecting. From then it works as expected.
What am I missing? I've tried to put the same code in "dbl-click" and "change" and still get the same result.
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,215,730
Messages
6,126,528
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top