Hi, I have quite a lot of documents to amend and house style and one of the tasks is deleting all wording within {Note } and I wondered whether a macro would do the job. I have attached an example document. Any help would be very much appreciated. Thanks Shelley
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Macro to delete certain wording within curly brackets (braces)
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Macro to delete certain wording within curly brackets (braces)
- This topic has 12 replies, 4 voices, and was last updated 8 years, 2 months ago.
AuthorTopicWSLady-Laughsalot
AskWoody LoungerMarch 9, 2017 at 4:25 am #508357Viewing 7 reply threadsAuthorReplies-
Charles Kenyon
AskWoody Lounger -
access-mdb
AskWoody MVPMarch 9, 2017 at 8:01 am #1593045I’ve just done a test on your Word Doc. On the Replace tab of find, click on more , then click on Use wildcards. The strings I entered are on the attachment. What you replace it with is up to you (you say words within the curly braces). Leave the replace field blank to replace the string with, well nothing.
The back slashes are required because { and } are special characters
Eliminate spare time: start programming PowerShell
-
WSLady-Laughsalot
AskWoody LoungerMarch 9, 2017 at 12:16 pm #1593065 -
access-mdb
AskWoody MVPMarch 9, 2017 at 1:27 pm #1593072OK, next iteration. You need to use {Note*} to find the relevant text. The capital of Note is required. Something to be aware of is that when it finds the string, it will put the final } at the top of the string (I’m assuming that the first time through you’ll do a find first before the replace to check it’s picking up the right text). Once you’re happy it’s doing what you want then a ‘replace all’ will be in order. When I did a replace all it removed 7 blocks of text – I assume that’s how many were in it.
Good luck!Eliminate spare time: start programming PowerShell
-
macropod
AskWoody_MVPMarch 9, 2017 at 5:52 pm #1593084You can’t specify the background shading as a Find/Replace parameter, besides which, the content you want to delete doesn’t all have that shading (e.g. {Note … }).
The basic Find/Replace macro code you’d incorporate into your larger process would be something like:
Code:With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "{Note*}" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With
If the shading is an issue, another approach will be required.
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSLady-Laughsalot
AskWoody LoungerMarch 10, 2017 at 5:18 am #1593093You can’t specify the background shading as a Find/Replace parameter, besides which, the content you want to delete doesn’t all have that shading (e.g. {Note … }).
The basic Find/Replace macro code you’d incorporate into your larger process would be something like:
Code:With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "{Note*}" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With
If the shading is an issue, another approach will be required.
Hi, many thanks for your responses to my query on this very much appreciated. I have managed to do a find and replace. There are a few places where the notes have not deleted and I can’t understand why. I’ve also added into the macro to delete the extra paragraphs. I attach an original document before I’ve run the macro and an updated document where I have run the macro. Thanks. Shelley
Code:Sub DPU_deletenotesdwf() ‘ ‘ DPU_deletenotesdwf Macro ‘ ‘ Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = “{Note*}” .Replacement.Text = “” .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.WholeStory Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = “[^13]{2,}” .Replacement.Text = “^p” .Forward = True .Wrap = wdFindContinue .Format = False .Forward = True .MatchWildcards = True .Wrap = wdFindContinue End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
-
-
access-mdb
AskWoody MVPMarch 10, 2017 at 5:38 am #1593094Shelley, I found one where it didn’t delete completely (under Charge) and that didn’t because there’s an embedded {} in the note – and neither my, or the macro’s methods can cope with that as they would terminate the find after 1s}
{Note
Charge{chargeNum IsMoreThan 1s}
List here those financial charges that are intended to be discharged on or before completion, so that the Property will be sold free of them. The definition is used primarily in relation to clause 8.
}Doing it my way you would have to check for those sorts of constructs. Perhaps Paul would be able to add such a thing to his macro (that’s beyond my pay-scale!)
Eliminate spare time: start programming PowerShell
-
WSLady-Laughsalot
AskWoody LoungerMarch 10, 2017 at 5:59 am #1593098I know what you mean about pay scale, I’m just a secretary trying to fathom this out with no support from IT so I really do appreciate all the help I get from here its made a massive difference to how I can get the mountain of work done and I can’t thank everyone enough really. Thanks for your help. Shelley
-
-
macropod
AskWoody_MVPMarch 11, 2017 at 1:20 am #1593263There is no practical way of extending the range to accommodate nested braces other than testing the found range, checking for any opening braces after ‘Note’ then extending by however many times as are necessary until one ends up with a matching count of opening and closing braces. That would require quite a different approach than what till now was a fairly simple Find/Replace.
PS: Shelley, I’d have thought by now – especially after all the code you’ve been given (or at least helped with) – you’d have learnt to do better than just use the macro recorder. All that ‘Selection’ stuff makes my eyes water.
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSLady-Laughsalot
AskWoody Lounger
-
-
macropod
AskWoody_MVPMarch 13, 2017 at 7:11 am #1593350Try:
Code:Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "{Note*}" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found Do While Len(Replace(.Text, "{", "")) Len(Replace(.Text, "}", "")) .MoveEndUntil "}", wdForward: .End = .End + 1 Loop .Delete .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
Cheers,
Paul Edstein
[Fmr MS MVP - Word] -
WSLady-Laughsalot
AskWoody Lounger
-
Viewing 7 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Google’s Veo3 video generator. Before you ask: yes, everything is AI here
by
Alex5723
3 hours, 35 minutes ago -
Flash Drive Eject Error for Still In Use
by
J9438
5 hours, 8 minutes ago -
Windows 11 Insider Preview build 27863 released to Canary
by
joep517
22 hours, 27 minutes ago -
Windows 11 Insider Preview build 26120.4161 (24H2) released to BETA
by
joep517
22 hours, 28 minutes ago -
AI model turns to blackmail when engineers try to take it offline
by
Cybertooth
2 hours, 7 minutes ago -
Migrate off MS365 to Apple Products
by
dmt_3904
2 hours, 55 minutes ago -
Login screen icon
by
CWBillow
5 hours, 34 minutes ago -
AI coming to everything
by
Susan Bradley
54 minutes ago -
Mozilla : Pocket shuts down July 8, 2025, Fakespot shuts down on July 1, 2025
by
Alex5723
1 day, 14 hours ago -
No Screen TurnOff???
by
CWBillow
1 day, 14 hours ago -
Identify a dynamic range to then be used in another formula
by
BigDaddy07
1 day, 15 hours ago -
InfoStealer Malware Data Breach Exposed 184 Million Logins and Passwords
by
Alex5723
2 days, 2 hours ago -
How well does your browser block trackers?
by
n0ads
1 day, 12 hours ago -
You can’t handle me
by
Susan Bradley
12 hours, 54 minutes ago -
Chrome Can Now Change Your Weak Passwords for You
by
Alex5723
1 day, 5 hours ago -
Microsoft: Over 394,000 Windows PCs infected by Lumma malware, affects Chrome..
by
Alex5723
2 days, 14 hours ago -
Signal vs Microsoft’s Recall ; By Default, Signal Doesn’t Recall
by
Alex5723
1 day, 17 hours ago -
Internet Archive : This is where all of The Internet is stored
by
Alex5723
2 days, 14 hours ago -
iPhone 7 Plus and the iPhone 8 on Vantage list
by
Alex5723
2 days, 14 hours ago -
Lumma malware takedown
by
EyesOnWindows
2 days, 2 hours ago -
“kill switches” found in Chinese made power inverters
by
Alex5723
2 days, 23 hours ago -
Windows 11 – InControl vs pausing Windows updates
by
Kathy Stevens
2 days, 23 hours ago -
Meet Gemini in Chrome
by
Alex5723
3 days, 3 hours ago -
DuckDuckGo’s Duck.ai added GPT-4o mini
by
Alex5723
3 days, 3 hours ago -
Trump signs Take It Down Act
by
Alex5723
3 days, 11 hours ago -
Do you have a maintenance window?
by
Susan Bradley
1 day, 16 hours ago -
Freshly discovered bug in OpenPGP.js undermines whole point of encrypted comms
by
Nibbled To Death By Ducks
2 days, 13 hours ago -
Cox Communications and Charter Communications to merge
by
not so anon
3 days, 14 hours ago -
Help with WD usb driver on Windows 11
by
Tex265
1 hour, 47 minutes ago -
hibernate activation
by
e_belmont
3 days, 23 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.