View Single Post
 
Old 12-31-2019, 10:51 AM
noslenwerd noslenwerd is offline Windows 10 Office 2016 for Mac
Novice
 
Join Date: Dec 2019
Posts: 15
noslenwerd is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Well TabValue (assuming that has been set to the value of your long string of replacement text) is too long for a Replacement.Text property.

You could have that long string set somewhere in the document e.g., a bookmark named "bmText" and use:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Dim strFind As String
Dim strReplace As String
  strFind = "<<testtag>>"
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .Text = strFind
    While .Execute
      oRng.Text = ActiveDocument.Bookmarks("bmText").Range.Text
      oRng.Collapse wdCollapseEnd
    Wend
  End With
lbl_Exit:
  Exit Sub
End Sub
Sorry not sure I follow.

Are you suggesting I house all the html content (about 40 lines) in a bookmark?

I am technically not using bookmarks in the overall macro, so not sure that will work.
Reply With Quote