頁: [1]
|
 |
|
作者
|
主題: 用巨集大量的修改多個Word檔的內容 (閱讀 981 次)
|
BETTA
中學生
離線
文章: 40
|
版主大大~ 要如何用巨集大量的修改多個Word檔的內容?? ============================ 之前曾問過Excel的用法如下~ 但是,要改的資料其實是.asp的檔案,用Excel的巨集會讓很多物件位置跑掉, 自己的能力又不足,改的不能用.... 所以,要麻煩版主大大幫忙改成word可以用的巨集。謝謝!! ============================
Sub 取代一大堆() Set fs = CreateObject("Scripting.FileSystemObject") Set fd = fs.GetFolder("D:\Temp") '取得資料夾 For Each f In fd.Files If fs.GetExtensionName(f.Name) = "xls" Then '取得副檔名 Workbooks.Open f.Path For Each sh In Worksheets sh.Cells.Replace "aaa", "bbb", xlPart Next ActiveWorkbook.Close True End If Next End Sub
|
|
|
|
|
已記錄
|
|
|
|
swsw3025987
小學生
離線
文章: 1
|
Sub 取代一大堆() Set fs = CreateObject("Scripting.FileSystemObject") Set fd = fs.GetFolder("D:\Temp") '取得資料夾 For Each f In fd.Files If fs.GetExtensionName(f.Name) = "doc" Then '取得副檔名 Documents.Open f.Path Set myRange = ActiveDocument.Content myRange.Find.Execute FindText:="aaa", ReplaceWith:="bbb", _ Replace:=wdReplaceAll ActiveDocument.Close True End If Next End Sub
|
|
|
|
|
已記錄
|
|
|
|
BETTA
中學生
離線
文章: 40
|
swsw3025987 大大 您好神,好帥哦~ 這麼不可思異的解好了,  謝謝!!
|
|
|
|
|
已記錄
|
|
|
|
|
頁: [1]
|
|
|
|