Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2019, 02:48 PM
jtomolonis08 jtomolonis08 is offline Macro to Change Document Font in All Documents in a Folder Windows 10 Macro to Change Document Font in All Documents in a Folder Office 2019
Novice
Macro to Change Document Font in All Documents in a Folder
 
Join Date: Jun 2019
Posts: 1
jtomolonis08 is on a distinguished road
Default Macro to Change Document Font in All Documents in a Folder

Hi All!

My ultimate goal is to write a macro that can be used via a simple Word shortcut key to 1) select a folder and 2) format the font of all Word documents in that folder.

I have been attempting to write a macro that can do the following:

1) Set all font to Times New Roman
2) Set all font size to 12 point
3) Remove text shading
4) Set font color to Automatic
5) Set scaling to 100%

I have tried recording a macro to do this but it only works on the document I have open. The macro is below:

Sub TestMacro()
'
' TestMacro Macro
'
'
Selection.WholeStory
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorAutomatic
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12


With Selection.Font
.NameFarEast = "+Body Asian"
.NameAscii = "Times New Roman"
.NameOther = "Times New Roman"
.Name = "Times New Roman"
.Size = 12
.Bold = False
.Italic = False
.Underline = wdUnderlineNone
.UnderlineColor = wdColorAutomatic
.StrikeThrough = False
.DoubleStrikeThrough = False
.Outline = False
.Emboss = False
.Shadow = False
.Hidden = False
.SmallCaps = False
.AllCaps = False
.Color = wdColorAutomatic
.Engrave = False
.Superscript = False
.Subscript = False
.Spacing = 0
.Scaling = 100
.Position = 0
.Kerning = 0
.Animation = wdAnimationNone
.DisableCharacterSpaceGrid = False
.EmphasisMark = wdEmphasisMarkNone
.SizeBi = 12
.NameBi = "Times New Roman"
.BoldBi = False
.ItalicBi = False
.Ligatures = wdLigaturesNone
.NumberSpacing = wdNumberSpacingDefault
.NumberForm = wdNumberFormDefault
.StylisticSet = wdStylisticSetDefault
.ContextualAlternates = 0
End With
End Sub

My problem is that I don't know how to get this to work on batches of documents in a folder. Can anyone point in the right direction to accomplish this? Thank you so much for your help!
Reply With Quote
  #2  
Old 06-07-2019, 05:59 PM
macropod's Avatar
macropod macropod is offline Macro to Change Document Font in All Documents in a Folder Windows 7 64bit Macro to Change Document Font in All Documents in a Folder Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,927
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There are numerous threads here with code showing how to loop through all documents in a folder - even for processing sub-folders. You might start by looking at those.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Change Document Font in All Documents in a Folder Merging two Word documents: 2nd document not maintaining original font type and font size Swarup Word 31 08-28-2018 06:55 PM
VBA code to run macro across all documents in folder rmk911 Word VBA 11 04-25-2018 02:38 PM
Macro to Change Document Font in All Documents in a Folder Looping Macro to Change Font, Font Size, and Give Heading 1 WH7262 Word VBA 1 08-26-2014 03:46 PM
Macro to Change Document Font in All Documents in a Folder macro to change name of files in a folder in order expert4knowledge Word VBA 5 07-10-2014 03:54 PM
Macro to Change Document Font in All Documents in a Folder Change font style and size in multiple documents fitkhan Word 1 04-27-2011 09:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:40 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2023 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft