Auto calc date + 1 month

B

Bill

I have a price sheet that automaticly inserts the current date, I would like
to insert another date 30 days ahead of that date, does anyone know how to
do this?

Thank you
Bill
 
D

Doug Robbins - Word MVP

Hi Bill,

To do it using vba, use the DateAdd() function:

DateAdd("d", 30, Date)

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
 
B

Bill

Doug

I am completely new at this, what would be the proper way to insert this
into a document?

I tried {=DateAdd("d", 30, Date)}
and I get syntax error

Please help
Thank you
Bill
 
D

Doug Robbins - Word MVP

Hi Bill,

If you want to use a field construction, you will have to use the method
shown in the article to which Macropod referred you.

To use a macro to insert such a date at the location of the cursor, the code
to use in the macro would be

Selection.InsertBefore Format(DateAdd("d", 30, 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
 
B

Bill

Doug

What I have is a document and when opened it shows today's date as the Bid
Date

example: Bid Date: 10/22/2003 Last Delivery Date at
this price: 11/22/2003

The bid date is created with Menu- [Insert] [Date and Time] , then top
item in list is selected and the option Update automatically is checked at
the bottom right of the dialog box.

The Last Delivery Date was created with Menu- [Insert] [Date and Time] ,
then top item in list is selected and the option Update automatically is
NOT
checked at the bottom right of the dialog box.

What exactly do I do to get the Last Delivery Date to automatically
display
Bid Date + 1 month when opened. so when printed the dates are correct.

I did look at the article to which Macropod referred me, but if you are
familiar with this you can understand it's syntax, but I am completely new
at this, this is why I am in the microsoft.public.word.vba.beginners
newsgroup.

Where can I go do get a full explanation of how to modify dates in word
for beginners step one?

Thanks
Bill
 
D

Doug Robbins - Word MVP

Hi Bill,

It sounds like what you should create is a template in which you use a {
CREATEDATE } field for the Bid Date and at the location where you want the
Last Delivery Date to appear, insert a bookmark which for the purpose of
this example, I will call lastddate.

Then in the template create a macro named autonew() that contains the
following code

ActiveDocument.Bookmarks("lastddate").Range.InsertBefore Format(DateAdd("m",
1, Date), "MM/dd/yyyy")

When you create a new document from the template by selecting New from the
File menu and then select that template as the basis of the document, the
{ CREATEDATE } field will display the present date and the date one month
later will be inserted into the bookmark.

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
Bill said:
Doug

What I have is a document and when opened it shows today's date as the Bid
Date

example: Bid Date: 10/22/2003 Last Delivery Date at
this price: 11/22/2003

The bid date is created with Menu- [Insert] [Date and Time] , then top
item in list is selected and the option Update automatically is checked at
the bottom right of the dialog box.

The Last Delivery Date was created with Menu- [Insert] [Date and Time] ,
then top item in list is selected and the option Update automatically is
NOT
checked at the bottom right of the dialog box.

What exactly do I do to get the Last Delivery Date to automatically
display
Bid Date + 1 month when opened. so when printed the dates are correct.

I did look at the article to which Macropod referred me, but if you are
familiar with this you can understand it's syntax, but I am completely new
at this, this is why I am in the microsoft.public.word.vba.beginners
newsgroup.

Where can I go do get a full explanation of how to modify dates in word
for beginners step one?

Thanks
Bill

Doug Robbins - Word MVP said:
Hi Bill,

If you want to use a field construction, you will have to use the method
shown in the article to which Macropod referred you.

To use a macro to insert such a date at the location of the cursor, the code
to use in the macro would be

Selection.InsertBefore Format(DateAdd("d", 30, 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
know
how
 
B

Bill

Doug

With your instructions I got just what I wanted.
Thank you so very much, I appreciate your time and effort.
Thanks again, have a great day.
Bill

Doug Robbins - Word MVP said:
Hi Bill,

It sounds like what you should create is a template in which you use a {
CREATEDATE } field for the Bid Date and at the location where you want the
Last Delivery Date to appear, insert a bookmark which for the purpose of
this example, I will call lastddate.

Then in the template create a macro named autonew() that contains the
following code

ActiveDocument.Bookmarks("lastddate").Range.InsertBefore Format(DateAdd("m",
1, Date), "MM/dd/yyyy")

When you create a new document from the template by selecting New from the
File menu and then select that template as the basis of the document, the
{ CREATEDATE } field will display the present date and the date one month
later will be inserted into the bookmark.

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
Bill said:
Doug

What I have is a document and when opened it shows today's date as the Bid
Date

example: Bid Date: 10/22/2003 Last Delivery Date at
this price: 11/22/2003

The bid date is created with Menu- [Insert] [Date and Time] , then top
item in list is selected and the option Update automatically is checked at
the bottom right of the dialog box.

The Last Delivery Date was created with Menu- [Insert] [Date and Time] ,
then top item in list is selected and the option Update automatically is
NOT
checked at the bottom right of the dialog box.

What exactly do I do to get the Last Delivery Date to automatically
display
Bid Date + 1 month when opened. so when printed the dates are correct.

I did look at the article to which Macropod referred me, but if you are
familiar with this you can understand it's syntax, but I am completely new
at this, this is why I am in the microsoft.public.word.vba.beginners
newsgroup.

Where can I go do get a full explanation of how to modify dates in word
for beginners step one?

Thanks
Bill

Doug Robbins - Word MVP said:
Hi Bill,

If you want to use a field construction, you will have to use the method
shown in the article to which Macropod referred you.

To use a macro to insert such a date at the location of the cursor,
the
code
to use in the macro would be

Selection.InsertBefore Format(DateAdd("d", 30, 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
Doug

I am completely new at this, what would be the proper way to insert this
into a document?

I tried {=DateAdd("d", 30, Date)}
and I get syntax error

Please help
Thank you
Bill

Hi Bill,

To do it using vba, use the DateAdd() function:

DateAdd("d", 30, Date)

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
I have a price sheet that automaticly inserts the current date, I
would
like
to insert another date 30 days ahead of that date, does anyone know
how
to
do this?

Thank you
Bill
 

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