Calculate Age

E

ericm

Is there a way to calculate a person's age. In a text form field the
person's birthdate is entered, and next to it will calculate the person's age
in years only.
Something like (today - whatever was entered into the form field = age
formatted for years only)
 
G

Graham Mayor

How hard is copy and paste when someone else has done the work for you?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

You could also do it with a macro run on exit from the Birthdate form field
to populate the Age formnfield eg

Sub CalculateAge()
Dim BirthDate As Date
Dim Age As Integer
BirthDate = ActiveDocument.FormFields("Birthdate").Result
Age = DateDiff("yyyy", BirthDate, Now)
ActiveDocument.FormFields("Age").Result = Age
End Sub

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JoAnn Paules

I assume it's done with VBA and for some reason, I've never had any luck
with VBA. I readily admit there are user issues so it's easier for me to do
a simple subtraction in Excel. :)
 
S

Suzanne S. Barnhill

So you didn't even look at the linked page to see that the method uses
fields and not VBA?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

JoAnn Paules said:
I assume it's done with VBA and for some reason, I've never had any luck
with VBA. I readily admit there are user issues so it's easier for me to do
a simple subtraction in Excel. :)

--

JoAnn Paules
MVP Microsoft [Publisher]
Tech Editor for "Microsoft Publisher 2007 For Dummies"


Graham Mayor said:
How hard is copy and paste when someone else has done the work for you?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

JoAnn Paules

I did a (super) quick glance. I'm better at subtracting. ;-)

--

JoAnn Paules
MVP Microsoft [Publisher]
Tech Editor for "Microsoft Publisher 2007 For Dummies"


Suzanne S. Barnhill said:
So you didn't even look at the linked page to see that the method uses
fields and not VBA?

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

JoAnn Paules said:
I assume it's done with VBA and for some reason, I've never had any luck
with VBA. I readily admit there are user issues so it's easier for me to
do a simple subtraction in Excel. :)

--

JoAnn Paules
MVP Microsoft [Publisher]
Tech Editor for "Microsoft Publisher 2007 For Dummies"


Graham Mayor said:
How hard is copy and paste when someone else has done the work for you?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


JoAnn Paules wrote:
Much easier in Excel. ;-)


On Tue, 13 May 2008 15:20:00 -0700, ericm
<[email protected]>
wrote:

Is there a way to calculate a person's age. In a text form field
the person's birthdate is entered, and next to it will calculate
the person's age
in years only.
Something like (today - whatever was entered into the form field =
age formatted for years only)

The field that does the computation will be complicated. See
http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=wrd&Number=249902.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 

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