|
-
Jun 26th, 2005, 01:09 PM
#1
Thread Starter
Frenzied Member
Want to eliminate symbols from the content of the word
Hi all,
I am just creating some sort of macros in MS Word. In that macro, I want to eliminate all the characters except "a to z", "A to Z" and "0 to 9" (i.e., all characters and Digits).
For example, the text in Word Document,
"I am currently reading "$56 in an hour" Book and, What? etc. and I will work on Mike's Project tomorrow. and Some more text here"
Clearly, I want to ignore all the symbols, full stop, colon, semicolon, quotation marks, space, non breaking space, not printable characters, etc. If I run a code it should change the above sentence as:
Iamcurrentlyreading56inanhourBookandWhatelseetcandIwillworkonMksProjecttomorrowandSomemoretexthere
Please help me!
Thanks,
CS.
-
Jun 26th, 2005, 06:03 PM
#2
Re: Want to eliminate symbols from the content of the word
test this, for some reason it left a few spaces in the text, but if i ran it again they all went
VB Code:
Selection.WholeStory
For i = Selection.Characters.Count To 1 Step -1
char = Selection.Characters(i)
Select Case char
Case "A" To "Z", "a" To "z", "0" To "9"
Case Else
Selection.Characters(i).Delete
End Select
Next
pete
-
Jun 27th, 2005, 03:03 AM
#3
Thread Starter
Frenzied Member
Re: Want to eliminate symbols from the content of the word
I know this way. We can use For.....Loop, or Do...While loop. Buy, the content of the document is huge then, this will take too much of time to process. Is there any other options available?
Is there any options, in Find & Replace to Find all symbols and delete it?
Thanks,
CS.
-
Jun 27th, 2005, 03:41 AM
#4
Re: Want to eliminate symbols from the content of the word
feel free, even if you use a replace function, while it seems to be less code to run, does not neccessarily work any faster, the only way to find out is speed tests
maybe it is possible in an xml schema, but i wouldn't be sure
i don't know of any way to use the LIKE operator with NOT to replace all characters that didn't match, or even if LIKE would work with Replace
pete
-
Jun 27th, 2005, 03:42 AM
#5
Member
Re: Want to eliminate symbols from the content of the word
Yes,
You can do this, By using following in the find what box -
[!Aa0-zZ9]
Replace it with "" (Nothing) then you would get the same results as you want.
Regards,
Alankar
PS- Don't forget to click the Use Wildcards box at the bottom.
The rest of mind is not in rest, It rests in rest. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|