Formatting merge field: Military to traditional time

C

Cloy

I'm running Office 2004 on OSX 10.5.5

When running a mail merge in Word, it is possible to convert military
time to a traditional format?

I'm pulling data from an Excel spreadsheet, generated by another
application, and the time data is stored as a four-digit number. For
example, if the data in the spreadsheet is "2000", I'd like it to
appear as "8:00 pm".

I have tried adding the following switch to the merge field: \@
"h:mm AM/PM"
but that does not seem to work.

I've also tried going into the spreadsheet and converting the time
field to "h:mm AM/PM" format; unfortunately, that converts everything
to "12:00".

Thanks, in advance!

-c
 
P

Peter Jamieson

Suppose your merge field is called mytime. Then you can try something based
on the following set of nested fields (each pair of } needs to be the
special "field code braces", and everything else is plain text:

{ QUOTE { SET H { =int({ MERGEFIELD mytime}/100) } }{ H }:{ ={ MERGEFIELD
mytime }-({ H }*100) } \@"hh:mm AM/PM" }

This constructs something that Word recognises as a TIME format, then uses
standard Date/time formatting switches, which you can change as required.

Getting field code braces on the Mac is not completely trivial because Mac
software tends to grab the control sequences that Word uses to insert them.
You can either fix that - e.g. see Daiya Mitchell's article at
http://word.mvps.org/mac/fieldsinmacword.html
or e.g. stuff in a field code such as a { MERGEFIELD } field, remove the
text, then copy/paste the remaining {} as many times as you need.
 

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