Reputation: 1144
When I save a file in Visual Studio 2005, I'd like to have a macro also run that updates a copyright (through a regular expression search and replace).
I'm not new to regular expressions, but I am new to VB/VBA and Visual Studio macros, so what I need help with specifically is:
getting a macro to run upon save, preferably after I press CTRL-S but before it actually writes the file so that the results of the search and replace are actually saved without having to save twice
calling search and replace for a regular expression from inside the VB/VBA macro
Upvotes: 2
Views: 994
Reputation: 2700
You can record, rename, and assign a macro. Here's what I did.
System.Text.RegularExpressions
.So the idea is you can record something that is almost what you want. Then tweak it, and assign it to a key combination. Definitely try your regex first and note that there will be a dialog interrupting you if anything in your solution is read-only.
Upvotes: 2