0
我試圖做一些文本文件的粗略解析。基本上,我希望刪除像(){}[]"'
這樣的字符,然後用分號替換冒號,然後用更好看的字符串替換字符串。VBA解析多個文本文件?
踢球者是我有大約1,500個文件,需要對他們做這件事。如果我合併所有的文件,首先,然後嘗試解析,應用程序停止響應。
我一直在使用Windows宏來做到這一點,它可以在每個文件上單獨運行,但我不知道如何讓它執行該目錄中的所有文件。我使用的代碼
例子:
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "["
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = "]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = """"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
你們願意接受一個PowerShell的解決方案還是你有意使用VB? – squillman 2011-01-23 00:40:09