Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 12-09-2018, 05:30 PM
macropod's Avatar
macropod macropod is offline need help creating a Word macro selecting all and changing font, size, and color thanks Windows 7 64bit need help creating a Word macro selecting all and changing font, size, and color thanks Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,380
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

Of course you do can both of those things. I can't imagine why anyone would want to bold an entire document, though, let alone all documents in a folder; that suggests you're specified the wrong font. It would have helped, though, if you'd taken the time to specify the scope of the task from the outset.

Code:
Sub ReformatDocuments()
Application.ScreenUpdating = False
Dim strFolder As String, strFile As String, strDocNm As String, wdDoc As Document
strDocNm = ActiveDocument.FullName
strFolder = GetFolder
If strFolder = "" Then Exit Sub
strFile = Dir(strFolder & "\*.doc", vbNormal)
While strFile <> ""
  If strFolder & "\" & strFile <> strDocNm Then
    Set wdDoc = Documents.Open(FileName:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
    With wdDoc
      With .Styles(wdStyleNormal).Font
        .Name = "Arial"
        .Size = 14
        .Bold = True
        .ColorIndex = wdDarkBlue
      End With
      With .Range
        .Style = wdStyleNormal
        .ParagraphFormat.Reset
        .Font.Reset
      End With
      .Close SaveChanges:=True
    End With
  End If
  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, "Choose 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]
Reply With Quote
 

Tags
font, font color, macro



Similar Threads
Thread Thread Starter Forum Replies Last Post
When changing table style in Word 2010, font size seems to change but doesn't show in new tables heartsoulliving Word 1 12-07-2016 05:17 PM
Word macro doesn't change font color Spideriffic Word VBA 8 11-04-2015 03:47 AM
need help creating a Word macro selecting all and changing font, size, and color thanks Changing the commentary font size in WORD 2013 to a larger one MikeD Word 3 06-01-2014 03:40 AM
need help creating a Word macro selecting all and changing font, size, and color thanks MAcro to List all the Font & its size in a word document shaukat74 Word VBA 1 01-29-2013 09:34 PM
changing font size without changing leading carolns Word 1 09-14-2009 12:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:15 PM.


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