#1
|
|||
|
|||
Search and replace symbols
Hi All
I've been writing some VBA to search and replace the random symbols which sometimes show up in emails. It effectively clears these out to leave a clean text. This works well to a point , but always leaves certain symbols which refuse to be cleared. There is one which is particularly stubborn. I can copy the symbol from the page , but when I try to paste into the search and replace dialogue , they fail to paste. I wonder if someone with greater expertise would be able to advise on a way to clear these symbols. I've attached a sample file that shows the offending symbols. Grateful for any help. |
#2
|
||||
|
||||
I assume you mean the ¬ characters. I have no problem pasting one of those into the Find dialogue. As their ASCII code is 172, you can also Find them via ^0172.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Ok thanks. I used ^0172 , and this has worked fine now. Many of the symbols are unfamiliar of course and single entry search and replace is making for a very long macro. It does a fair job of cleaning up emails which tend to become full of them , but it's a pity there's no shorter method.
|
#4
|
||||
|
||||
See: https://www.msofficeforums.com/word/...s-e-mails.html
The code there will do most of the work. Admittedly, characters like ¬ aren't dealt with as they're not normally found in emails. That said, they and any other characters you want to delete (or replace with spaces) could easily be added to a single wildcard Find expression.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Ok thanks for your help. I've got it working substantially correctly now , but appreciate it's difficult to be entirely accurate in clearing everything to leave pristine text.
|
#6
|
|||
|
|||
BTW - do you know of a single wildcard expression which would remove these unwanted symbols? I imagine it would have to seek to remove anything that was not a character , not a digit , not comma , not full stop , not apostrophe etc. I'm afraid such a coding would be above my abilities , but if you have such a thing I'd be grateful.
|
#7
|
||||
|
||||
Quote:
Without knowing what all "these unwanted symbols" are, it's impossible to say. As I said before, though, characters like ¬ aren't normally found in emails, so I don't really know what you're dealing with.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Yes I agree that with a little painstaking weeding , all can be restored to it's original state. I'm finding that the more an email conversion has passed back and forth in transport , the more complicated it becomes to unpick. The harder part is restoring shape and coherence to the text during the search and replace procedures. I'm trying really to arrive at a macro that can be applied to any email and give a good result. This may be forlorn , of course , but I'll do my best.
|
#9
|
||||
|
||||
Since you seem not to be inclined to say what the other problem symbols/characters are, or how you want them treated, I can't really help you any further.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#10
|
|||
|
|||
Ok I'll attach a sample file to show the extent of the issue. You'll be able to see the symbols we're dealing with.
The harder part I'm finding is leaving reconstituted text as it was originally sent. I've removed names and email addresses from the file , otherwise it's exactly as sent originally. Grateful for your help. |
#11
|
||||
|
||||
It seems to me you could do the vast majority of the clean-up with a single wildcard Find/Replace expression:
Find = [ \> ΒΓΕΖ'⬑’Ύ]{2,} Replace = nothing
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#12
|
|||
|
|||
Ok thanks. That's much neater , and is considerably more elegant than my solution.
|
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Search and replace | hernans | Word VBA | 5 | 07-02-2018 07:01 PM |
Find and replace symbols help | gogreen | Word | 10 | 02-28-2017 05:00 PM |
replace words between two symbols | capitala | Word VBA | 9 | 02-03-2014 03:57 AM |
Search and Replace - Clear Search box | JostClan | Word | 1 | 05-04-2010 08:46 PM |
Find and Replace - symbols | clisco | Word | 5 | 01-03-2010 05:57 AM |