![]() |
|
|
|
#1
|
||||
|
||||
|
Try: Code:
Sub UpdateDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, wdDoc As Document
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.docx", vbNormal)
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
With wdDoc
With .Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = True
.Text = ""
.Font.NameAscii = "Arial"
.Font.SizeBi = 11
.Replacement.Text = ""
.Replacement.Font.NameAscii = "David"
.Replacement.Font.SizeBi = 20
.Wrap = wdFindContinue
.Execute Replace:=wdReplaceAll
End With
.Close SaveChanges:=True
End With
strFile = Dir()
Wend
Set wdDoc = Nothing
Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
Dim oFolder As Object
GetFolder = ""
Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Select a folder", 0)
If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
Set oFolder = Nothing
End Function
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to change all text color to black in all docx files in a selected folder
|
joewoods | Word VBA | 13 | 05-16-2016 06:29 PM |
| Macro to change/convert/delete txt files in folder+subfolders | NoS | Word VBA | 4 | 03-03-2016 12:10 PM |
| Macro to replace SSN in all files within a folder | caj1980 | Word VBA | 7 | 09-11-2014 04:17 PM |
macro to change name of files in a folder in order
|
expert4knowledge | Word VBA | 5 | 07-10-2014 03:54 PM |
Word Macro - change date in footer for all files in a folder
|
patidallas22 | Word VBA | 2 | 03-09-2012 08:14 AM |