Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 05-16-2021, 10:05 PM
Guessed's Avatar
Guessed Guessed is offline Automatically Inserting Brackets to EACH selected line Windows 10 Automatically Inserting Brackets to EACH selected line Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This will may get your 'headings' as well if you didn't format them with built-in styles.
Code:
Sub BracketsOnBold()
  With Selection.Find
    .ClearFormatting
    .Font.Bold = True
    .ParagraphFormat.OutlineLevel = wdOutlineLevelBodyText  'this excludes headings
    .Replacement.ClearFormatting
    .Text = ""
    .Replacement.Text = "[^&]"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
macro edit, macro multiple functions



Similar Threads
Thread Thread Starter Forum Replies Last Post
syntax for inserting blank line before inserting table and after a line or paragraph SamDsouza Word VBA 8 08-04-2019 11:10 PM
How to move a line to another line that starts with a chain selected in the 1st one? gloub Word VBA 24 03-19-2019 03:12 PM
Automatically Inserting Brackets to EACH selected line find and delet all text within brackets and the brackets themselves wrdy Word 2 08-03-2017 06:55 PM
Automatically Inserting Brackets to EACH selected line macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
Inserting nested brackets in a field code deletes numeration piotrek99 Word 1 11-02-2014 01:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:38 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