E
E
esy19932015-08-19 17:50:46
Macros
esy1993, 2015-08-19 17:50:46

How to calculate date in Word?

Hello!
It is necessary to implement the insertion of the current date + 90 days in the MS Word document line.
Used the field Label (Inscription). Poking around with the inscription module:

Private_Sub вычисляемая_дата_Click()
Dim d As Date
вычисляемая_дата.Value = d + 90
End Sub

It does not give errors, but it displays 01/01/1900 in the inscription.
Tell me how to do it right?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Fedoryan, 2015-08-20
@esy1993

You need the DateAdd() function :

Sub test()
    Dim d As Date
    d = DateAdd("d", 90, Now)
    Selection.TypeText (d)
End Sub

E
esy1993, 2015-08-22
@esy1993

Thank you!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question