Find/Replace! Please

R

Rods

I'm having the followig problem.

I do have a timeline like the following (ET is Easter Time):

10:00ET - Xxxxxxxxx
12:05ET - Xxxxxxxxx
12:08ET - Xxxxxxxxx
12:13ET - Xxxxxxxxx

I'm trying to do a macro with find/replace that could change the time
zone and change the time like:
(PT - Pacific Time)
07:00PT - Xxxxxxxxx
09:05PT - Xxxxxxxxx
09:08PT - Xxxxxxxxx
09:13PT - Xxxxxxxxx

I know how to decrease the date but, don't have any idea how to use it
with Find/Replace.
I was thinking about :
1st - Find "^#^#:^#^#ET"
2nd - Get only "^#^#:^#^#" and cast is to date(doing this because if
it is 01:00AM Easter time it would be 22:00PM Pacific Time) in a
variable
3rd - Decrese 3 hours
4rd - Replace it with Newhour & "PT"

But... how to do that??

Does someone could help me?

Thanks
Rod
 
D

Doug Robbins - Word MVP

Use the following code:

Dim trange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="[0-9]{2}:[0-9]{2}ET", MatchWildcards:=True,
Wrap:=wdFindStop, Forward:=True) = True
Set trange = Selection.Range
trange.Text = Format(DateAdd("h", -3, Left(trange.Text, 5)),
"hh:mm") & "PT"
Loop
End With


--
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