Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-28-2022, 03:27 PM
Frogoogue Frogoogue is offline How to code a Find&Replace macro to remove a tab and bold the entire para Windows 10 How to code a Find&Replace macro to remove a tab and bold the entire para Office 2019
Novice
How to code a Find&Replace macro to remove a tab and bold the entire para
 
Join Date: May 2022
Posts: 3
Frogoogue is on a distinguished road
Default How to code a Find&Replace macro to remove a tab and bold the entire para

I have a Word document with interviewer questions and answers
The format is like this:
<Interviewer:><^t><One or more sentence(s) with closing punctuation><^p>
and I want an MS Word Find and Replace macro to convert each instance into this:
<bold><Interviewer:><space><Identical One or more sentence(s) with closing punctuation><^p></bold>

The macro routine would look something like this:

Sub Reformat_Tabbed_Para()


'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = True
With Selection.Find
.Text = <><><><>
.Replacement.Text = "\1[space]\3\4"

.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub

I believe there is code allowing me to find and replace the same string of characters and punctuation up to the ^p but cannot find the correct way of writing it.
Help would be much appreciated!
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for Find/replace to remove space before Hard Return AlfredStreich Word VBA 4 01-23-2020 03:59 PM
Create a macro or Find/Replace Code to delete tags bonzai217 Word 2 08-04-2019 08:36 AM
How to code a Find&amp;Replace macro to remove a tab and bold the entire para Macro to find and replace headings in bold and underline redzan Word VBA 4 02-13-2016 12:24 PM
Macro code that prompts user to enter text, then does find/replace. sfvegas PowerPoint 0 01-10-2016 08:02 PM
Looking for code to create a macro that prompts user to enter text, then does a find/replace. sfvegas PowerPoint 0 01-08-2016 02:22 AM

Other Forums: Access Forums

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