|
-▼ぺろ さん:
Sub test()
Dim fdg As FileDialog, p As String
Dim fso As Object, f As Object
Dim doc As Document, s As Shape, r As Range
Dim flg As Boolean
Set fdg = Application.FileDialog(msoFileDialogFolderPicker)
If Not fdg.Show Then Exit Sub
p = fdg.SelectedItems(1) & "\"
Set fso = CreateObject("scripting.filesystemobject")
For Each f In fso.getfolder(p).Files
If LCase(fso.getextensionname(f.Path)) = "docx" Then
Set doc = Documents.Open(f.Path)
For Each s In doc.Shapes
Set r = s.TextFrame.TextRange
With r.Find
.Text = "あいうえお" '検索する文字列
.Replacement.Text = "かきくけこ" '置換後の文字列
.Execute Replace:=wdReplaceAll
If .Found Then flg = True
End With
Next
doc.Close flg
flg = False
End If
Next
End Sub
|
|