August 25, 2010
Point of Personal Privilege - I Need Help on a Word Macro
I have a manuscript file that was typeset for some ancient version of Ventura Publisher, I think, and I need to convert it to Microsoft Word 2003 (or 2007 of 2010).
I've managed to convert all the silly, custom VP formatting into ordinary Word formatting, all except for one class of transformations: I must somehow convert VP italics to Word underlines.
Through a brilliant series of global search and replaces, I managed to turn all the italics formatting into constructs that look like this: (em)phrase to be underlined(/em), or on some occasions, (em)phrase to be underlined, followed by the end-of-paragraph marker. But I need somehow to turn them into actual Word formatting that looks like this: phrase to be underlined... that is, actually underlined in Word.
Thinking about it as best I can, it seems I need a macro that does something like the following:
- Search for the opening italics code, (em).
- Turn on "select".
- Search for the closing code, (/em), or else for the end of the paragraph.
- Close selection, leaving the phrase selected.
- Format the selection with the underline character format.
Later on, I can delete all the (by then redundant) ems and /ems, and all's well in the world.
Alas, however, I have no idea how to construct such a macro! The part I'm missing is how to turn on and then off the selection, leaving the phrase sandwiched between actually selected; and then how to format the characters of that particular selection: If I just searched for the (em), then searched for the (/em), the insert bar would just move to the latter, and nothing would be selected.
Can any reader-genius out there help me? It's rather important that I convert this file, and there are way too many italicized phrases to do by hand. You can respond either via comments, or else by the semi-secret, semi-sweet blog e-mail address, which you can find in the right-hand column in a cool box.
Hatched by Dafydd on this day, August 25, 2010, at the time of 1:44 AM
TrackBack URL for this hissing: http://biglizards.net/mt3.36/earendiltrack.cgi/4562
The following hissed in response by: Jack Squatch
Dafydd, the only that comes to mind would be to change your (em) and (/em) codes to the html equivalents you desire.... and try Word in HTML mode... if that works then it's easy to just save it back as word doc. I have no idea what it would do to the rest of your document during the conversion.
I'd try it for you but I'm on a iMac with an incredibly old version of Word.... good luck!! great website too by the way...
The following hissed in response by: Barney15e
In the Find and Replace dialog, select Use Wildcards in the options at the bottom. You may have to click the Details button or whatever it says. I've got a Mac version.
Use this string in the Find part:
In the Replace field, use:
Click the Format button and change the font format to underline.
If you care, the backslash (\) says to find the literal character after it. In Wildcard mode, the parenthesis are used to block out sections of text. So, to search for them in text, you have to use \(. The * finds everything in between the (em) and (/em) tags and groups it into a block of text. The blocks are numbered 1 to whatever you have blocked out by parenthesis. The \1 in the Replace tells it to replace everything found with the first block of text.
The following hissed in response by: Dafydd ab Hugh
Yay, it worked. There was some mess left to clean up, caused by the twenty-four instances in which the opening code was not followed by an explicit closing code. Evidently, in Ventura Publisher, if the code goes to the end of the paragraph, the end-of-paragraph marker automatically closes the code anyway... so the typesetter didn't put in the redundant close code.
In each case, what happened was a huge block of text before the opening code was also underlined... but I manually searched through the document and corrected each instance by hand. (Only those twenty-four instances, so far as I know.)
I believe the problem is completely solved, now. If there are any other long blocks of underlining, I'll see them when I do a page-by-page last lookthrough before sending it to the editor.
Thanks a million, Barney15e!
The above hissed in response by: Dafydd ab Hugh at August 26, 2010 12:19 PM
The following hissed in response by: seePea
Next time you have a similar problem, try keeping the formatting from VP and follow these steps:
Post a comment
Thanks for hissing in, . Now you can slither in with a comment, o wise. (sign out)(If you haven't hissed a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Hang loose; don't shed your skin!)
© 2005-2009 by Dafydd ab Hugh - All Rights Reserved