Need a macro to convert any occurrence of date in the format of dd/mm/yyyy to mm/dd/yyyy

M

Mary Wilcox

Would someone be able to help with a macro to convert any occurrence of date in
the format of dd/mm/yyyy to mm/dd/yyyy. In other words, taking something that
looks like a date but switching the first part which is actually the day, with
the second part which is actually the month. I have a type of document that has
this almost every line.

A general solution that would work with any modern date would be great but if
that's too complicated or takes too much time to figure out, just something to
switch whatever today's date is, like 18/05/2007 back to 05/18/2007, would be
great.

I'm not a programmer so any help would be greatly appreciated.

Thank you,
Mary
 
D

Doug Robbins - Word MVP

You do not need a macro, it can be done with a wildcard Edit>Replace with

([0-9]{2})\/([0-9]{2})\/([0-9]{4})

in the Find what control, and

\2/\1/\3

in the Replace with control.

For an explanation, see the article "Finding and replacing characters using
wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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