Calendar

  • Thread starter Thread starter Terry V
  • Start date Start date
T

Terry V

Hello
I have an application where I use a calendar on a userform (userform1).
Im trying to have the user select a date, type in information into an
inputbox and then get prompted again if they want to select another date,
but (as you probably know), when I click on the calendar to select another
date, the code runs again from the beginning.

How can I have it prompt the user "do you want to enter another date?" ; up
to a maximum of 5 times (when they select NO on the msgbox (vbNo), it should
exit the loop.

Thank you
Terry V
 
I did find "a" solution --- although many of you will agree; its not pretty:

Private Sub Calendar1_Click()
Dim dte As Date
Dim x As Integer
Dim msg As String
Dim results
Dim tme As String
Dim msg2 As String

dte = Me.ActiveControl
tme = InputBox("What time do you work?", "Input Hrs")
UserForm1.Hide
workinghrs = workinghrs & vbCrLf & dte & " " & tme
msg = "Do you want to enter another day?"
'UserForm1.Show
results = MsgBox(msg, vbYesNo)
If results = vbYes Then
UserForm1.Show
Else
msg2 = "Here are your hrs, please copy and paste them" & vbCrLf & workinghrs
MsgBox msg2
End If

End Sub

Thank you
Terry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top