Problem with find and replace macro

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhescript01
    New Member
    • Oct 2007
    • 8

    Problem with find and replace macro

    Hi everyone,
    I got a macro that performs a find and replace function on a text.It's working fine but for some unicode character it replaces with weird character despite of original text character.


    Code snippet given below::
    [CODE=VB]
    Selection.find. ClearFormatting
    Selection.find. Replacement.Cle arFormatting
    With Selection.find
    .Text = findeditcontrol .Text
    .Replacement.Te xt = replaceeditcont rol.Text
    With Selection
    If .find.Forward = True Then
    .Collapse Direction:=wdCo llapseStart
    Else
    .Collapse Direction:=wdCo llapseEnd
    End If
    .find.Execute replace:=wdRepl aceOne
    End With
    [/CODE]
    Last edited by Dököll; Dec 27 '07, 12:42 AM. Reason: [CODE=VB] tag...
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by santhescript01
    Hi everyone,
    I got a macro that performs a find and replace function on a text.It's working fine but for some unicode character it replaces with weird character despite of original text character.


    Code snippet given below::
    [CODE=VB]
    Selection.find. ClearFormatting
    Selection.find. Replacement.Cle arFormatting
    With Selection.find
    .Text = findeditcontrol .Text
    .Replacement.Te xt = replaceeditcont rol.Text
    With Selection
    If .find.Forward = True Then
    .Collapse Direction:=wdCo llapseStart
    Else
    .Collapse Direction:=wdCo llapseEnd
    End If
    .find.Execute replace:=wdRepl aceOne
    End With[/CODE]
    Hello Hello!

    Is this VB or VBA? I am not too skilled in running or building a macro. What types of characters are you referring to, can you add them here, they're in a pop up!

    Sorry for your troubles.

    Dököll

    Comment

    • santhescript01
      New Member
      • Oct 2007
      • 8

      #3
      Originally posted by Dököll
      Hello Hello!

      Is this VB or VBA? I am not too skilled in running or building a macro. What types of characters are you referring to, can you add them here, they're in a pop up!

      Sorry for your troubles.

      Dököll
      hi,
      The code is in VBA. Unicode characters are being referred.

      Comment

      Working...