-
Thank you once again.
The original question was based on this being an active x replacement for a word document to allow calendar controls for Macs.
I greatly appreciate the code you originally provided and it seems to be working fine as I follow your directions.
Could I ask one more question as the novice I am?
I create a text field names "today" and call the test macro on entry. What code do I need to add and where to fill in the selected date to the field?
Thank you for the superior work, it appears to have been helpful to many.
Richard
-
I would use a slightly modified version of my original second block of code:
[vba]
' This must go in at the top of the code for your userform.
Dim displayDate As Date
' This was the test() macro. No need to put it elsewhere, so just attach
' it directly to the event of interest.
Private Sub Today_Enter()
Load DatePick
' The following shows how to place the calendar position at the calling control position,
' if that is useful to you.
' DatePick.startupposition = 3
' DatePick.Left = Today.Parent.Left + Today.Left
' DatePick.Top = Today.Parent.Top + Today.Top
' Note: If date not supplied to DatePick, current date will be used.
Call DatePick.FillVars()
DatePick.Show
' In mm/dd/yyyy form. Mix and match as desired.
Today.Text = DatePart("m", displayDate) & "/" & DatePart("d", displayDate) & "/" & DatePart("yyyy", displayDate)
End Sub
' This must be included somewhere in the userform code. Must NOT be
' marked Private
Sub returnDate(dD As Date)
displayDate = dD
End Sub[/vba]
I'm glad the code works for you. I realize that it's expanded considerably more than you needed in the past few days - your question just gave me an excuse to embark on a small project that I've had waiting for a while.
![Beerchug](images/smilies/beerchug.gif)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules