Hi all,
I've been searching for a solution for this problem for days.
I'm not using the vba replace function instead I'm using the word
replace macro.
Problem is this macro will not accept text exceeding 255 characters.
Note: Line 6 where value inserted to "replacement.text" assigned to
"replacement_"
And error occurs in this scenario.
Is there a way to insert more than 255 characters using the ms.word-
replace macro below?
I need to use the ms.word-replace macro below, because it can insert
the data in right places in the document.
Please help me on this, thanks!
Code:Word Replace Macro ================ Private Sub Replacer(target_, replacement_) 'Dim replacement_ As Long With Selection.Find .Text = target_ .replacement.Text = replacement_ <----Error Prompt - String too Long .replacement.Font.Hidden = False .Execute Replace:=wdReplaceOne, Forward:=True End With Selection.Find.Execute With Selection If .Find.Forward = True Then .Collapse Direction:=wdCollapseStart Else .Collapse Direction:=wdCollapseEnd End If .Find.Execute Replace:=wdReplaceOne If .Find.Forward = True Then .Collapse Direction:=wdCollapseEnd Else .Collapse Direction:=wdCollapseStart End If .Find.Execute End With Call StartPointer End Sub




Reply With Quote