week number

J

John Andersen

Can anyone tell me how to display the week number in a word 2003 document. The week number should be a number between 1 and 53. I need a functions like weeknumber(Date) which takes a date as input and displays the actual week number in the document. The document I am working with is being used for a mail merge document. Therefor I can not use a Macro since that would require that I use the macro on every document in the merge. I don't understand why this is not already a function or field in word already since I believe a week number is being used very often.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?Sm9obiBBbmRlcnNlbg==?=,
Can anyone tell me how to display the week number in a word 2003 document. The week
number should be a number between 1 and 53. I need a functions like weeknumber(Date)
which takes a date as input and displays the actual week number in the document. The
document I am working with is being used for a mail merge document. Therefor I can not
use a Macro since that would require that I use the macro on every document in the merge.
I don't understand why this is not already a function or field in word already since I
believe a week number is being used very often.If you can't use a macro, then you shouldn't be posting in a VBA group, since VBA is only
about macros.

FWIW, however, without a macro there's no way for you to get the week number. However,
you could use a macro during the mail merge execution of Word 2003 to do the calculation
and insert the value in the document.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :)
 
C

Chris Joyce

Try:

weekofyear = Format(<yourDate>, "ww")

this will return the week a date is in
but if your weeks started on the first monday (5/1/2004) or some other day
then you will need to use
something like this

Sub weekofyear()
Dim whatdate As Date
whatdate = Now()
MsgBox ("This week is week : " & DateDiff("ww", DateSerial(Year(Now()), 1,
5), whatdate))

' DateDiff( intival to display , date 1 , date 2)
' DateSerial(Year,Month,Day)

End Sub


chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top