F
FotoArt
hello everyone
i have here a piece of code provided by doug.
i need to do the search after putting the whole content of my page into a
range object.
i hope by doing that i will be able to leave the selecion intact.
any help is appreciated.
Dim Seconds As Long
Seconds = 0
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="[0-9]{2}:[0-9]{2}:[0-9]{2}", Forward:=True,
_
MatchWildcards:=True, Wrap:=wdFindStop, MatchCase:=True) = True
Seconds = Seconds + Val(Left(Selection, 2)) * 3600 +
Val(Mid(Selection, 4, 2)) * 60 + Val(Right(Selection, 2))
Selection.Collapse wdCollapseEnd
Loop
End With
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
..Text = "Total Time = " & Format(Int(Seconds / 3600), "00") & ":" &
Format(Int((Seconds Mod 3600) / 60), "00") & ":" & Format((Seconds Mod 60),
"00")
..ParagraphFormat.Alignment = wdAlignParagraphRight
End With
thanx
ahmed
i have here a piece of code provided by doug.
i need to do the search after putting the whole content of my page into a
range object.
i hope by doing that i will be able to leave the selecion intact.
any help is appreciated.
Dim Seconds As Long
Seconds = 0
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(Findtext:="[0-9]{2}:[0-9]{2}:[0-9]{2}", Forward:=True,
_
MatchWildcards:=True, Wrap:=wdFindStop, MatchCase:=True) = True
Seconds = Seconds + Val(Left(Selection, 2)) * 3600 +
Val(Mid(Selection, 4, 2)) * 60 + Val(Right(Selection, 2))
Selection.Collapse wdCollapseEnd
Loop
End With
With ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Range
..Text = "Total Time = " & Format(Int(Seconds / 3600), "00") & ":" &
Format(Int((Seconds Mod 3600) / 60), "00") & ":" & Format((Seconds Mod 60),
"00")
..ParagraphFormat.Alignment = wdAlignParagraphRight
End With
thanx
ahmed