I write my stories (and occasionally long board or LJ posts) using Microsoft Word. I suspect many others do too. Although Word docs can be submitted directly to FictionAlley and FFN, postings to LJ require the text to be properly marked up in HTML, and postings to Chamber of Secrets and other bulletin boards require it to be marked up in a square-bracket substitute called VBCode. Word's "Save as HTML" feature isn't much help with the former (as it stuffs vast amounts of junk into the files) and no help at all with the latter.
A while back I got fed up with the tedious and somewhat error-prone job of hand-coding stuff I was posting, and decided to get the computer to do it instead. So I wrote a set of Word VBA macros that scan the document and fill in the main types of markup automatically (one reason I was able to face reposting 30 revised chapters of NTLJ at CoS Forums).
Anyway, for anyone else who would like to try them out and report back, links and instructions below the cut.
What the macros actually do
There are two main macros -- one for HTML markup and one for VBCode -- and like any macro they can be attached to a hotkey or a menu, or put on a toolbar. They cover the following types of formatting:
Text in bold, italics or underline
Text marked in red, blue, green, or orange
Links (to either files or email addresses)
Text in large and small sizes
Paragraphs that are centred
Paragraphs that are right-aligned
Paragraphs that have indented margins (this obviously only actually shows up properly if you have a paragraph of reasonably sufficient length in the first place, such as this one for example)
Quoted material (for board postings)
Bulleted and simple numbered lists
Word characters that may not show up in all browsers are replaced with ASCII:
-- "smart quotes" (the typographically correct versions, different for start and end quotes) are replaced with ordinary single or double quotes
-- em dashes are replaced with "--"
-- ellipses are replaced with three full stops
Other font changes (e.g. exact size or typeface) aren't covered (at present), but the above should cope with at least 99% of the things you need to do.
You may want to try this on a copy of a document first, of course (although you can always reverse the changes with Undo).
Notes on Word features and required formatting
To get text in one of the four colours mentioned, select Format --> Font --> Font color (or click the toolbar button if it's there -- letter "A" with a coloured bar under it) and pick a colour from the palette which pops up. You need to use the colours Word thinks of as "red", "green", "blue" and "orange", not other shades thereof -- if in doubt, let the mouse hover over the little square of colour until the "tooltip" text appears. (Orange was added to the three basic colours for the purposes of references to Riddikulus fics at FictionAlley Park -- but you could define any other colours you want.)
URLs and email addresses are ignored unless actually marked as links in the Word doc using Word's "add a link" feature -- highlight the text you want to be a link, and press Ctrl-K or select Insert --> Hyperlink.
For the purpose of these macros, an indented paragraph is anything in which both left and right margins have been indented by any amount.
Lists have to be simple bulleted or numbered Word lists -- alphabetic lists and nested lists are not currently supported.
To get the [quote] ... [/quote] tags around material for a board posting, you have to mark up the paragraph(s) concerned with a style "VBCodeQuote". You'll need to define that -- go to Format --> Style --> New, then type "VBCodeQuote" into the Name box and set whatever font characteristics you want.
If you highlight a part of the document, only those paragraphs will be marked up; otherwise the whole document will. It's fairly fast so it's not a big problem if you forget. (A quick test run on 180,000 words of NTLJ took less than a minute -- a single chapter or oneshot should only take a few seconds.) Bug: links are marked up even if they're not in the selected part.
Very important: there are three distinct macros here -- AddHTMLMarkup, AddHTMLMarkupWithBreaks, and AddVbCodeMarkup. The first and last of these assume you're posting the code into something that automatically converts line breaks into
tags -- the default for HTML postings on LJ, the case for CoS, FAP and other VBulletin-based places, and probably the case at most other places too -- and so they don't add these tags, or HTML paragraph tags. This is almost certainly what you want to happen, or rather not happen. However, some other places (especially archives such as Checkmated and the Sugar Quill) require the
tags, and that's what the AddHTMLMarkupWithBreaks macro is for.
The files
Right, here's where you can actually get the files:
As a .bas file:
markupcodes.bas As a .zip file (if your system blocks files with a .bas extension):
markupcodes.zip Save the markupcodes.bas file on the desktop or anywhere else convenient.
How to get them into Word
Select Tools --> Macro --> Visual Basic Editor in Word to launch the macro editor
In the editor select File --> Import File, then select and open the markupcodes.bas file from the file picker
You can pick the name of the macro from the Macros list every time you want to run it if you prefer (Tools --> Macro --> Macros, highlight the one you want then click Run) but it's probably easier to attach it to a hotkey or put it on a menu or toolbar. This is longwinded but easier than it sounds.
To do that, first right-click on any Word toolbar, select Customize from the menu, then click the Commands tab in the resulting popup. You can then do one of two things:
To put the macro on a menu or toolbar -- select "Macros" from the Categories list, highlight the macro you want in the Commands list, and drag it to the menu or toolbar you want. If you put it on a toolbar, you may want to edit the name showing on the toolbar to something shorter that doesn't take up so much space.
Alternatively, to attach it to a hotkey -- click the Keyboard button, select "Macros" from the Categories list in the popup, highlight the macro you want in the resulting Macros list, click in the Press new shortcut key box, then press the key you want to use (I use Ctrl-Alt-H for HTML and Ctrl-Alt-V for VBCode). Click Assign, then keep clicking Close buttons until you're back in the document.
Personally, I have all three macros as buttons on the toolbar, but that's just what suits me.
Final notes
This has been tested on Word 2000 and 2003 on Windows 2000, but should work on other compatible versions. If you find this useful, or fairly useful but can think of improvements, let me know. It's been rather cobbled together, so any Word VBA experts out there can probably find much better ways of doing things -- but hey, it works, and I've found it a handy little tool.