Hello,
I have the below code which replaces the invalid characters. Can anyone please help me to make a similar macro code for MICROSFT WORD?
Thank you![]()
Please Login or Register to view this content.
Hello,
I have the below code which replaces the invalid characters. Can anyone please help me to make a similar macro code for MICROSFT WORD?
Thank you![]()
Please Login or Register to view this content.
Word has nothing equivalent to Excel's Worksheet_Change event.
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Thank you. Can I replace the invalid characters in word without change events using VBA?
You can use a wildcard Find/Replace.
I don't have knowledge of MSWORD VBA. Could you please let me know how to use wildcard Find/Replace in VBA.
I want to replace "[~`!#$%^*]" all these characters with Nullstring.
Thank you
Try:
![]()
Please Login or Register to view this content.
Last edited by macropod; 01-28-2018 at 07:10 PM.
Thank you. It's working. How to make this macro available for all word documents and how to assign this macro to the toolbar?
To make it available to all documents, add the macro to Word's 'Normal' template. Your profile indicates you're using Office 2010, which doesn't have a toolbar. I suggest you simply create a keyboard shortcut; otherwise, to add the macro to the Quick Access Toolbar, use File|Options|Quick Access Toolbar>Choose commands from:Macros.
Although the "use wildcards" option in Word's Find dialog does a lot of what RegEx does, it is not the same as RegEx.
Your point being? Sure Word's "use wildcards" option isn't a complete RegEx solution, but it does everything the OP needs and it'll also do a lot you can't do with RegEx.
Regex in MS products is unnecessarily tedious and difficult. If you have a document where you need to replace a great deal of formatting or test, you are better off opening the document first in LibreOffice, making the replacements, then saving to MS format.
Last edited by larrybradley; 11-20-2023 at 11:58 AM.
Using Regex in MS Office products is unnecessarily difficult and tedious. If you have a lot of Find and Replace tasks in a large document, it is far easier to first open the document in LibreOffice and use that program's sensible and sane Regex
functions to do your Find and Replace, then save back to MS format.
Thanks, but the thread is already five and a half years old ...![]()
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
NB: as a Moderator, I never accept friendship requests.
Forum Rules (updated August 2023): please read them here.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks