It has worked this morning.
I contemplated generalizing it (choice of brackets, format of time stamp etc), but couldn't be bothered.
Code: Select all
Function TimeStampParagraph(rng As Range)
Static dtStopWatch As Date
If rng.Start = 0 Then ' we are at the head of the document; reset the stopwatch
dtStopWatch = Now()
Else
End If
Dim strTimeStamp As String
strTimeStamp = Format((Now() - dtStopWatch), "(hh:mm:ss)")
Dim strTestLeft As String
strTestLeft = Left(Selection.Paragraphs(1).Range.Text, 10)
While strTestLeft Like "[(]##:##:##[)]"
Dim strSPRT As String
strSPRT = Selection.Paragraphs(1).Range.Text
strSPRT = Right(strSPRT, Len(strSPRT) - Len(strTestLeft))
strTestLeft = Left(strSPRT, 10)
Wend
Selection.Paragraphs(1).Range.Text = strTimeStamp & strSPRT
Selection.MoveDown Unit:=wdParagraph, Count:=1
'Sub TESTTimeStampParagraph()
' ' I find this useful when it is assigned to a shortcut key, such as Ctrl-Shift-K.
' ' Use Ctrl-Home to place the text cursor at the head of the transcript document; this causes the procedure to reset the stop-watch.
' ' Start playing back your MP3 track in WinAmp, or start reading your upcoming speech or training material aloud.
' ' Each time WinAmp reaches a new paragraph, run the macro (Ctrl-Shift-K) to time-stamp that paragraph.
' '
' Call TimeStampParagraph(Selection.Range)
'End Sub
End Function
Chris