By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,594 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,594 IT Pros & Developers. It's quick & easy.

Problem with find and replace macro

P: 8
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::
Expand|Select|Wrap|Line Numbers
  1. Selection.find.ClearFormatting
  2. Selection.find.Replacement.ClearFormatting
  3. With Selection.find
  4. .Text = findeditcontrol.Text
  5. .Replacement.Text = replaceeditcontrol.Text
  6. With Selection
  7. If .find.Forward = True Then
  8. .Collapse Direction:=wdCollapseStart
  9. Else
  10. .Collapse Direction:=wdCollapseEnd
  11. End If
  12. .find.Execute replace:=wdReplaceOne
  13. End With
  14.  
Dec 26 '07 #1
Share this Question
Share on Google+
2 Replies


Dököll
Expert 100+
P: 2,364
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::
Expand|Select|Wrap|Line Numbers
  1. Selection.find.ClearFormatting
  2. Selection.find.Replacement.ClearFormatting
  3. With Selection.find
  4. .Text = findeditcontrol.Text
  5. .Replacement.Text = replaceeditcontrol.Text
  6. With Selection
  7. If .find.Forward = True Then
  8. .Collapse Direction:=wdCollapseStart
  9. Else
  10. .Collapse Direction:=wdCollapseEnd
  11. End If
  12. .find.Execute replace:=wdReplaceOne
  13. End With
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
Dec 27 '07 #2

P: 8
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.
Dec 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.