Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-19-2014, 02:52 PM
ronmayerle ronmayerle is offline VBA code to enable Regular Expression Windows 8 VBA code to enable Regular Expression Office 2007
Novice
VBA code to enable Regular Expression
 
Join Date: Nov 2014
Posts: 2
ronmayerle is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 11-19-2014, 03:22 PM
macropod's Avatar
macropod macropod is offline VBA code to enable Regular Expression Windows 7 64bit VBA code to enable Regular Expression Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 11-20-2014, 01:09 PM
ronmayerle ronmayerle is offline VBA code to enable Regular Expression Windows 8 VBA code to enable Regular Expression Office 2007
Novice
VBA code to enable Regular Expression
 
Join Date: Nov 2014
Posts: 2
ronmayerle is on a distinguished road
Default

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)
Reply With Quote
Reply

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
VBA code to enable Regular Expression 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
VBA code to enable Regular Expression 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:16 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft