Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2025, 11:40 PM
WJSwanepoel WJSwanepoel is offline Change all text in frames Windows 10 Change all text in frames Office 2021
Advanced Beginner
Change all text in frames
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 82
WJSwanepoel is on a distinguished road
Question Change all text in frames

I have a word document with many pieces of text with outside borders around. I wish to find all these and do the following:
1. remove the border
2. Change font of the text (say to Calibri)
3. Make it bold.



Would it be possible to do this in VBA?

A sample is attached.
Attached Files
File Type: docx Sample.docx (19.1 KB, 8 views)
Reply With Quote
  #2  
Old 01-09-2025, 02:52 AM
macropod's Avatar
macropod macropod is offline Change all text in frames Windows 10 Change all text in frames Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

For example:

Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Para As Paragraph
With ActiveDocument
  For Each Para In .Paragraphs
    With Para
      If .Borders.Enable = True Then
      .Range.Font.Name = "Calibri"
      .Range.Font.Bold = True
      .Borders.Enable = False
      End If
    End With
  Next
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 01-09-2025, 03:42 AM
WJSwanepoel WJSwanepoel is offline Change all text in frames Windows 10 Change all text in frames Office 2021
Advanced Beginner
Change all text in frames
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 82
WJSwanepoel is on a distinguished road
Default Thank You!

The VBA works , thank you.
Only one more question: As it stands it changes the font of the paragraph but leaves the numbers in whatever font it was. Is there any way of ensuring the font of the numbers change as well? If not, I will do those by hand.
Reply With Quote
  #4  
Old 01-09-2025, 04:36 AM
macropod's Avatar
macropod macropod is offline Change all text in frames Windows 10 Change all text in frames Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,370
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

You can do that for all numbered paragraphs in one go by simply clicking on a numbered paragraph and choosing Paragraph|Numbering>Define New Number Format>Font>Bold.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 01-09-2025, 04:46 AM
gmaxey gmaxey is offline Change all text in frames Windows 10 Change all text in frames Office 2019
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,599
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Macropod is on the other side of the world from me and may not be around for another couple of hours. You can try:

Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Para As Paragraph
  With ActiveDocument
    For Each Para In .Paragraphs
      With Para
        If .Borders.Enable = True Then
          .Range.Font.Name = "Calibri"
          .Range.Font.Bold = True
          If .Range.ListFormat.ListType <> 0 Then
             .Range.ListFormat.ListTemplate.ListLevels(1).Font.Name = "Calibri"
          End If
          .Borders.Enable = False
        End If
      End With
    Next
  End With
  Application.ScreenUpdating = True
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 01-09-2025, 05:06 AM
WJSwanepoel WJSwanepoel is offline Change all text in frames Windows 10 Change all text in frames Office 2021
Advanced Beginner
Change all text in frames
 
Join Date: Dec 2019
Location: Krugersdorp, South Africa
Posts: 82
WJSwanepoel is on a distinguished road
Default Works like a charm!

Good day Greg,
Thank you very much. You have solved my problem excellently. Much appreciated.
Reply With Quote
Reply

Tags
bold text, border, font change



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using text frames in the Footnote area RRB Word 9 12-07-2023 02:30 AM
Preventing Word inserting unwanted frames around text SueN Word 4 04-05-2023 08:28 PM
why does applying "table text bold" format to last row sometimes trigger the appearance of frames? pkacsor Word Tables 3 02-27-2023 03:56 PM
Convert all Frames to Text stky Word VBA 1 12-05-2021 06:41 AM
Frames, Frames, Frames: How to eliminate them but keep the text? Dakota Word 8 02-09-2014 01:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:41 AM.


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