Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2010, 12:49 PM
Kimberly Kimberly is offline word 2003 date picker Windows 7 word 2003 date picker Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

You could type this text in the document where you want the date:



Date: TheDateMark

(that is, the word "date", a colon, a space, and then 11 characters to be replaced by the code)

This code will find the text Date<space>:, and replace the 11 characters that follow it with the date.

Code:
 
Private Sub Calendar1_Click()
    Selection.HomeKey Unit:=wdStory
    Selection.Find.ClearFormatting
    With Selection.Find
        .Text = "Date: "
        .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
Reply With Quote
  #2  
Old 09-27-2010, 12:56 PM
nashville nashville is offline word 2003 date picker Windows XP word 2003 date picker Office 2003
Novice
word 2003 date picker
 
Join Date: Sep 2010
Posts: 8
nashville is on a distinguished road
Default

Yes, this does replace the date with one selected in the calendar. Is it possible to add an additional calender in the document. will the code remain the same?

Thank you !
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculations using values from date picker controls Inkarnate Word 0 06-09-2010 07:16 AM
Date Function in word? aligahk06 Word 1 04-21-2010 06:33 AM
Word 2007 date and time picker dmcohio Word 2 04-09-2010 04:13 AM
new appointment date always reverts back to today's date msills Outlook 0 08-24-2007 08:57 AM
word 2003 date picker Imported message date change to today's date promark Outlook 1 12-23-2005 07:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:52 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft