我有偶爾有褻瀆的電視腳本,必須引起第三方的注意。我建立了一個搜索特定單詞的宏,臨時對它們進行破壞,使它們不再被重複找到,並列出它們,並列出它們在宏中發生的時間......問題:即使沒有運行它,我也知道它會只能找到第一個單詞......有時他們會說同一個單詞20次...我需要列出每個出現的時間碼和時間碼。不要替換,或突出顯示。只需列出單詞。我到目前爲止...任何幫助表示讚賞。Word宏查找褻瀆,並創建一個出現名單
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
由於沒有人對我的問題進行過嘗試,所以我認爲這個詞不夠清楚。一個例子,它搜索的內容是:01:03:05:22等等等等等等等等等等等等等等等等等。下一行01:09:44:22等等等等等等(我用'狗'和'貓')從腳本 – CJG 2012-04-13 18:08:29
講更多等等等等沒人能幫忙嗎?真? – CJG 2012-05-02 22:42:17