![]() |
#1
|
|||
|
|||
![]()
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! |
#2
|
||||
|
||||
![]()
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] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
WH7262 | Word VBA | 1 | 08-26-2014 03:46 PM |
![]() |
expert4knowledge | Word VBA | 5 | 07-10-2014 03:54 PM |
![]() |
fitkhan | Word | 1 | 04-27-2011 09:49 PM |