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
-
Windows 10/11 clock app
by
Kathy Stevens
34 minutes ago -
Turn off right-click draw
by
Charles Billow
2 hours, 5 minutes ago -
Introducing ChromeOS M137 to The Stable Channel
by
Alex5723
5 hours, 36 minutes ago -
Brian Wilson (The Beach Boys) R.I.P
by
Alex5723
6 hours, 48 minutes ago -
Master patch listing for June 10, 2025
by
Susan Bradley
7 hours, 13 minutes ago -
Suggestions for New All in One Printer and a Photo Printer Windows 10
by
Win7and10
13 hours, 11 minutes ago -
Purchasing New Printer. Uninstall old Printer Software First?
by
Win7and10
13 hours, 15 minutes ago -
KB5060842 Issue (Minor)
by
AC641
17 hours, 48 minutes ago -
EchoLeak : Zero Click M365 Copilot leak sensitive information
by
Alex5723
20 hours, 20 minutes ago -
24H2 may not be offered June updates
by
Susan Bradley
2 hours, 44 minutes ago -
Acronis : Tracking Chaos RAT’s evolution (Windows, Linux)
by
Alex5723
1 day, 8 hours ago -
June 2025 updates are out
by
Susan Bradley
9 hours, 1 minute ago -
Mozilla shutting Deep Fake Detector
by
Alex5723
1 day, 23 hours ago -
Windows-Maintenance-Tool (.bat)
by
Alex5723
1 day, 9 hours ago -
Windows 11 Insider Preview build 26200.5641 released to DEV
by
joep517
2 days, 2 hours ago -
Windows 11 Insider Preview build 26120.4250 (24H2) released to BETA
by
joep517
2 days, 2 hours ago -
Install Office 365 Outlook classic on new Win11 machine
by
WSrcull999
2 days, 2 hours ago -
win 10 to win 11 with cpu/mb replacement
by
aquatarkus
1 day, 18 hours ago -
re-install Windows Security
by
CWBillow
2 days, 5 hours ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 days, 9 hours ago -
macOS Tahoe 26
by
Alex5723
2 days, 3 hours ago -
Migrating from win10 to win11, instructions coming?
by
astro46
14 hours, 31 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
1 day, 17 hours ago -
Recommended watching : Mountainhead movie
by
Alex5723
1 day, 18 hours ago -
End of support for Windows 10
by
Old enough to know better
1 day, 2 hours ago -
What goes on inside an LLM
by
Michael Covington
1 day, 12 hours ago -
The risk of remote access
by
Susan Bradley
8 hours, 28 minutes ago -
The cruelest month for many Office users
by
Peter Deegan
20 hours, 40 minutes ago -
Tracking protection and trade-offs in Edge
by
Mary Branscombe
1 day, 22 hours ago -
Supreme Court grants DOGE access to confidential Social Security records
by
Alex5723
3 days, 7 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.