Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 05-09-2019, 03:42 PM
gmaxey gmaxey is offline Can I find-and-replace text in all Quickparts at once? Windows 10 Can I find-and-replace text in all Quickparts at once? Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

When you insert quickpart in a document you are left with just inserted content (it isn't a quickpart anymore). After you create your document, try something like this:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim arrTerms() As String
Dim lngIndex As Long
Dim oRng As Range
Dim strReplace As String
  arrTerms = Split("[n],[e],[m]", ",")
  For lngIndex = 0 To UBound(arrTerms)
    strReplace = InputBox("What do you want to replace " & arrTerms(lngIndex) & " with?")
    Set oRng = ActiveDocument.Range
    With oRng.Find
      .Text = arrTerms(lngIndex)
      .Replacement.Text = strReplace
      .Execute Replace:=wdReplaceAll
    End With
  Next lngIndex
lbl_Exit:
  Exit Sub
  
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I find-and-replace text in all Quickparts at once? Find and replace a text with a field eduzs Word VBA 6 02-23-2018 05:19 PM
Can I find-and-replace text in all Quickparts at once? How To find Text and replace with equation maamiradina Word 2 12-17-2016 11:08 PM
Can I find-and-replace text in all Quickparts at once? Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Macro to find coloured text and replace with form-field/formtext containing that text tarktran Word VBA 1 11-26-2014 08:12 AM
Can I find-and-replace text in all Quickparts at once? Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM

Other Forums: Access Forums

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