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 / Mailmerge and Fax / August 2003

Tip: Looking for answers? Try searching our database.

specific but changing date code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff - 25 Aug 2003 03:33 GMT
I want to insert a field code into a form that would
display the following Sunday's date. For our church
secretary as she makes the bulletin each week. The date
that would show up as she edits the form would be the
following Sunday's date. Any ideas?? I'm stumped.
Graham Mayor - 25 Aug 2003 12:26 GMT
Calculations on date codes are extremely complex and best avoided - See the
relevant section on dates at
http://www.addbalance.com/word/wordwebresources.htm

A macro is a much simpler proposition and the following will insert next
Sunday's date. (You can change the mask on the last line to suit your date
formatting requirements).

Sub InsertSunday()
   Today = (Now)
       Do Until Sunday = "Sun"
       Today = Today + 1
       Sunday = Format(Today, "ddd")
       Loop
  Selection.InsertAfter Format(Today, "dddd, d MMMM yyyy")
End Sub

See http://www.gmayor.dsl.pipex.com/installing_macro.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP
      E-mail gmayor@mvps.org
  Web site www.gmayor.dsl.pipex.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> I want to insert a field code into a form that would
> display the following Sunday's date. For our church
> secretary as she makes the bulletin each week. The date
> that would show up as she edits the form would be the
> following Sunday's date. Any ideas?? I'm stumped.
Jeff - 26 Aug 2003 14:46 GMT
Gentlemen:

Thanks to all of you!!  Blessings and Peace-
Jeff
>-----Original Message-----
>I want to insert a field code into a form that would
[quoted text clipped - 3 lines]
>following Sunday's date. Any ideas?? I'm stumped.
>.
Doug Robbins - Word MVP - 29 Aug 2003 13:22 GMT
Hi Jeff,

Here's a neater bit of code:

Selection.InsertBefore Format(DateAdd("d", 8 - Weekday(Date), Date), "d MMMM
yyyy")

Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
> Gentlemen:
>
[quoted text clipped - 7 lines]
> >following Sunday's date. Any ideas?? I'm stumped.
> >.
 
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.