Omnimaga
General Discussion => Technology and Development => Computer Programming => Topic started by: AngelFish on December 26, 2010, 03:05:52 pm
-
Hey, if anyone has any skill with Word Macros, some help would be appreciated. What I need to do is take the first N characters of every line and delete them from the document. Is there any practical way to do this?
Thanks for any replies.
-
Im not too experienced with macros, but i know they use mostly VB. what i would try doing first would be to move the cursor to the beginning of each row and set the cursor location as the startindex of remove (remove(cursor, N) ) but idk if thats possible. If not, you could use sendkeys. I could write a VB program that does this to a txt file but im not sure how to do it in a macro.
-
Here's a way to do it with the find and replace dialog:
- Open the find and replace dialog
- View the extra options and make sure "Use wildcards" is unchecked
- Find "^p" and replace all with "^v"
- Check "Use wildcards"
- Find "^v[!^v]{1,x}" (x is the number of characters to remove) and replace all with "^v"
- Uncheck "Use wildcards"
- Find "^v" and replace all with "^p"
This works at least for my version, which is Word 2007. Tell me if this doesn't work for you.