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 / July 2005

Tip: Looking for answers? Try searching our database.

Formatting Dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
axeman - 06 Jul 2005 16:54 GMT
Hello all,

When I run the code below the date format still comes out as mm/dd/yy
instead of the specified mmmm d, yyyy format. Why is that? Is there some kind
of rule against formatting when using the Date() or Now() functions? Is there
a work around to it. I can't just set the actual field on template to be a
Date field because it holds a strings as well as the date. Any suggestions?

Code Sample:
Dim ReturnDate As String

ReturnDate = DateAdd("w", 7, Date)
ActiveDocument.FormFields("ReturnDate").Result = Format(ReturnDate, "mmmm d,
yyyy")
Doug Robbins - 06 Jul 2005 19:24 GMT
Works fine for me as long as the ReturnDate formfield is a Text FormField.

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

> Hello all,
>
[quoted text clipped - 14 lines]
> d,
> yyyy")
axeman - 06 Jul 2005 19:36 GMT
That just goes to show that I'm not paying attention. I had the code right
but I was using the ReturnDate variable in another location of the document
without formatting it before use. I had only formatted it when I set the
result of the formfield. Got it worked out now!

Thanks,
Axe
 
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.