View Single Post
 
Old 05-09-2019, 03:42 PM
gmaxey gmaxey is offline Windows 10 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