#1
|
|||
|
|||
VBA code to enable Regular Expression
I have been writing relatively complex macros with Word 2007 VBA using Regular Expressions. Because I am relatively new to macros, my code has corrupted the Normal Folder numerous times. Each time, I delete the Normal Folder and then restart Word...which generates a new and uncorrupted Normal Folder. But each time I have to enable RegExp again by going to the VBA toolbar and clicking Tools>References>Regular Expressions 5.5. Is there a line of code that I insert at the start of a macro to do this automatically?
Thanks in Advance. |
#2
|
||||
|
||||
Anything that automatically adds a reference to the VBE would require giving trusted access to the VBA project model. IMHO, making that your default configuration would be most unwise from a security standpoint. Might I suggest a better approach would be to: (a) keep a backup of your Normal Template; and (b) not use your Normal Template for development work.
In any event, Word's own wildcard Find/Replace routines can do much of what RegEx does, without the need for the Regular Expressions reference.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Paul,
Your suggestion to use Word's own wildcard Find/Replace routine solved problem one. I will also take your advice regarding the Normal template. Thank you greatly, Ron Mayerle Geolgist (retired), VBA programmer (Active Amateur) |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Microsoft Expression Web | ts6947 | Misc | 0 | 02-22-2013 08:20 AM |
Can pass .expression as a parameter? | tinfanide | PowerPoint | 4 | 12-28-2012 06:14 PM |
Reg expression/ wildcards for mass replacement of contents in table | ghumdinger | Word Tables | 0 | 07-31-2010 12:21 PM |
Conditional Expression that Moves Data (challenging) | themangoagent | Excel | 1 | 02-20-2010 11:29 AM |
evaluating a text expression in a form field | gwp1 | Word | 0 | 10-08-2007 02:15 PM |