Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2007

Tip: Looking for answers? Try searching our database.

Updating Date Field passed through a Variable string

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kerri - 03 Apr 2007 21:47 GMT
Hi,

I'm looking for a way to insert a dynamic date (automatically update
Date Field, like in the headerfooter autotext)  to the end of a
variable string. Is this possible?

The date formatting would be: (4/3/07)

This is an example of the string used...each Name is variable that is
combined here.
strFtrInfo = DocNum & "." & DocVer & " \ " & CNumMat & Date

This is how I insert it.  I use StoryRanges and not selection to
insert into the doc.
pFooter.insertafter strFtrInfo

Then it inserts
52222.1 \ 12554 (4/3/07)

Thank you for your help.
Kerri
Doug Robbins - Word MVP - 04 Apr 2007 08:19 GMT
If you want to insert a date in the form of a field that can be updated,
then you would have to insert an actual date field by using:

ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
Text:="Date \@ " & Chr(34) & "M/d/yy" & Chr(34), PreserveFormatting:=False

If you just want to insert the current date in that format, then use

strFtrInfo = DocNum & "." & DocVer & " \ " & CNumMat & Format(Date,
"M/d/yy")
Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi,
>
[quoted text clipped - 17 lines]
> Thank you for your help.
> Kerri
Kerri - 04 Apr 2007 18:14 GMT
Doug,

Thank you for responding. I was affraid of that.  My other thought was
to make the date in the specific format as an autotext and pull it in
to the variable?  I'll test them out.

Thank you for your time and help!
Kerri

On Apr 4, 12:19 am, "Doug Robbins - Word MVP"
<d...@REMOVECAPSmvps.org> wrote:
> If you want to insert a date in the form of a field that can be updated,
> then you would have to insert an actual date field by using:
[quoted text clipped - 37 lines]
>
> - Show quoted text -
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.