|
|
Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Hi, I'm figuring this is probably an easy thing to do...for someone who has a clue. Unfortunately, I don't.
What I'd like to do (and I'm using a Mac/Word2004) is this:
find 12:00:00 and change it to 12:01:00 (or 12:00:01, doesn't matter) and then the next instance 12:00:02 and so on through 59.
Is this possible using MS Word? (I also have Virtual PC, which lets me emulate WIndows apps, and tried a piece of shareware I found online, but never could get it to work right) I don't know how macros and VBA works; have never used it or figured it out. ::shrug::
What I'm doing is importing flat text files into a WordPress database, and one of the fields is date/time. I've got thousands of files, and each time field needs to be a second off the next for this to work right.
Thank you. :) -- To email, remove the kitty litter...
|
|
Something like: Sub FRWithSequentialNumber() Dim startNum As String Dim myRange As Range Set myRange = ActiveDocument.Range startNum = "01" With myRange.Find .Text = "12:00:00" .MatchWholeWord = True While .Execute myRange.Text = "12:" & Format(startNum, "00:00") If startNum = "59" Then startNum = "01" Else startNum = startNum + 1 End If myRange.Collapse Direction:=wdCollapseEnd Wend End With End Sub
Carol wrote:
[Quoted Text] > Hi, I'm figuring this is probably an easy thing to do...for someone who > has a clue. Unfortunately, I don't. > > What I'd like to do (and I'm using a Mac/Word2004) is this: > > find 12:00:00 and change it to 12:01:00 (or 12:00:01, doesn't matter) > and then the next instance 12:00:02 and so on through 59. > > Is this possible using MS Word? (I also have Virtual PC, which lets me > emulate WIndows apps, and tried a piece of shareware I found online, but > never could get it to work right) I don't know how macros and VBA works; > have never used it or figured it out. ::shrug:: > > What I'm doing is importing flat text files into a WordPress database, > and one of the fields is date/time. I've got thousands of files, and > each time field needs to be a second off the next for this to work right. > > Thank you. :) > -- > To email, remove the kitty litter...
|
|
The following will do it on a Windows machine; no guarantee about a Mac
Dim i As Long, myrange As Range i = 1 Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(FindText:="[0-9]{2}:[0-9]{2}:[0-9]{2}", _ MatchWildcards:=True, Wrap:=wdFindStop, Forward:=True) = True Set myrange = Selection.Range Selection.Collapse wdCollapseEnd Selection.MoveRight wdCharacter, 1 myrange.Text = Left(myrange.Text, 6) & Format(i, "0#") i = i + 1 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
"Carol" <carCATLITTERolj12345[ at ]gmail.com> wrote in message news:WvQug.131781$dW3.38578[ at ]newssvr21.news.prodigy.com...
[Quoted Text] > Hi, I'm figuring this is probably an easy thing to do...for someone who > has a clue. Unfortunately, I don't. > > What I'd like to do (and I'm using a Mac/Word2004) is this: > > find 12:00:00 and change it to 12:01:00 (or 12:00:01, doesn't matter) > and then the next instance 12:00:02 and so on through 59. > > Is this possible using MS Word? (I also have Virtual PC, which lets me > emulate WIndows apps, and tried a piece of shareware I found online, but > never could get it to work right) I don't know how macros and VBA works; > have never used it or figured it out. ::shrug:: > > What I'm doing is importing flat text files into a WordPress database, > and one of the fields is date/time. I've got thousands of files, and > each time field needs to be a second off the next for this to work right. > > Thank you. :) > -- > To email, remove the kitty litter...
|
|
Unbelievable...this worked like a charm!!!
I can't thank you enough.
Greg, I tried yours, but got some kind of error. However, know that I probably did something wrong, because I really had no idea what I was doing.
Thanks again so very much, both of you. I'm so stunned this worked...LOL. Just saved me 12 billion hours of going through it by hand. :) Life is good.
In article <eddQiPdqGHA.4408[ at ]TK2MSFTNGP04.phx.gbl>, "Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> wrote:
[Quoted Text] > The following will do it on a Windows machine; no guarantee about a Mac > > Dim i As Long, myrange As Range > i = 1 > Selection.HomeKey wdStory > Selection.Find.ClearFormatting > With Selection.Find > Do While .Execute(FindText:="[0-9]{2}:[0-9]{2}:[0-9]{2}", _ > MatchWildcards:=True, Wrap:=wdFindStop, Forward:=True) = True > Set myrange = Selection.Range > Selection.Collapse wdCollapseEnd > Selection.MoveRight wdCharacter, 1 > myrange.Text = Left(myrange.Text, 6) & Format(i, "0#") > i = i + 1 > 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 > > "Carol" <carCATLITTERolj12345[ at ]gmail.com> wrote in message > news:WvQug.131781$dW3.38578[ at ]newssvr21.news.prodigy.com... > > Hi, I'm figuring this is probably an easy thing to do...for someone who > > has a clue. Unfortunately, I don't. > > > > What I'd like to do (and I'm using a Mac/Word2004) is this: > > > > find 12:00:00 and change it to 12:01:00 (or 12:00:01, doesn't matter) > > and then the next instance 12:00:02 and so on through 59. > > > > Is this possible using MS Word? (I also have Virtual PC, which lets me > > emulate WIndows apps, and tried a piece of shareware I found online, but > > never could get it to work right) I don't know how macros and VBA works; > > have never used it or figured it out. ::shrug:: > > > > What I'm doing is importing flat text files into a WordPress database, > > and one of the fields is date/time. I've got thousands of files, and > > each time field needs to be a second off the next for this to work right. > > > > Thank you. :) > > -- > > To email, remove the kitty litter...
-- To email, remove the kitty litter...
|
|
|