我的电视剧本中偶尔会有亵渎,必须引起第三方的注意。我构建了一个宏来搜索特定的单词,暂时将它们变形,这样它们就不会再次被重复找到,并列出它们,以及它们在宏中出现的时间......问题:甚至没有运行它,我知道它会只找到单词的第一个实例...有时他们说同一个单词 20 次...我需要列出每个出现的时间和时间码。不替换或突出显示.. 仅列出单词。到目前为止我所拥有的......任何帮助表示赞赏。
Sub Macro7()
'
' Macro7 Macro
'
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "dog"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Copy
' places cursor inside the word so I can disfigure it
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
' xxx1 temporarily disfigures the word so it isn't re-found over and over
Selection.TypeText Text:="xxx1"
' goes to end of document and pastes the word there,
' to be joined by the matching timecode to be found next
Selection.EndKey Unit:=wdStory
Selection.PasteAndFormat (wdPasteDefault)
Selection.Find.ClearFormatting
' returns to last instance of word and finds time code
' immediately preceeding it
With Selection.Find
.Text = "xxx1"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
'this is finding the time code
.Text = "^?^?:^?^?:^?^?:^?^?"
.Replacement.Text = ""
.Forward = False
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
' copies the time code value and goes to bottom of document
' to paste it with the word previously found
Selection.Copy
Selection.EndKey Unit:=wdStory
Selection.TypeText Text:=vbTab
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeParagraph
Selection.Find.ClearFormatting
' returns to the word just found
With Selection.Find
.Text = "xxx1"
.Forward = False
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=1
' begins the process for the next word "cat"
Selection.Find.ClearFormatting
With Selection.Find
.Text = "cat"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Copy
' places cursor inside the word so I can disfigure it
' etc etc etc
End Sub