Thread: [Solved] word 2003 date picker
View Single Post
 
Old 07-22-2011, 02:07 AM
Neoxis Neoxis is offline Windows Vista Office 2007
Novice
 
Join Date: Jul 2011
Posts: 1
Neoxis is on a distinguished road
Default

Quote:
Originally Posted by Kimberly View Post
By default the first calendar you insert is named Calendar1
By default the second calendar you insert is named Calendar2
(right-click on a calendar and choose Properties to see this)

So if Calendar1 is for EffectiveDate: , the code should look like:

Code:
Private Sub Calendar1_Click()
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "EffectiveDate: "
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=11, Extend:=wdExtend
    Selection.Text = Format(Calendar1.Value, "mmm dd yyyy")
End Sub
If the ExpirationDate: calendar is named Calendar2, then the code will be like the above, with three exceptions... the calendar name (twice) and the text to find. I suspect you did not edit the final line to be the value for Calendar2.
ei man i tried what you said and changed the those 3 (i.e. Calendar1->Calendar2)
however whenever i choose the second date of the same calendar it's not the Text in the " .Text = "EffectiveDate: " " is not the one changed. How can i solve this thanks...
Reply With Quote