How to export from Scrivener to Word with correct styles

This is a macro to export from Scrivener to Word with correct Heading and Body styles. This also correctly handles in-paragraph bold and italics. It is based off the excellent work by Félix Chénier.

When I tried his method, it correctly fixed all the heading styles, but it did not update the body text to be ‘Normal’ style. This is of course a bit of a pain if you want to update style of your whole body text at once.

It would be trivial to add a  p.Style = ActiveDocument.Styles(wdStyleNormal)  to his macro assuming that would fix the problem.

However, if you happen to have paragraphs that are comprised solely of italicised or bolded text, then Word will convert those to regular (non italic or bold) text. Apparently if a paragraph is <50% bold or italic, Word assumes those words are for emphasis and keeps them when it does the style conversion. But if it is >50%, then it will turn the whole paragraph just to plain ‘Normal’ style.

So, we have to set as ‘Normal’ and then go through word-by-word and turn the text to its original emphasis.


Luckily I have written the macro for that. It takes your italicised text and temporarily converts it to pink highlighted text. Word does not remove highlights when it converts a paragraph style, so after the conversion the macro knows exactly which words to convert back to the original style. After the conversion it then removes the temporary highlighting. This works for both italic and bold text.

There are two caveats:

  1. If you try and convert your whole document at once, it will simply crash. It’s probably bad coding on my part, maybe someone can suggest a better option. However, if you select 3-4 pages at a time then that seems to work perfectly.
  2. If you happen to have pink or red highlighted text in your document, then you will lose that. Please edit the code to a safe colour!

How to use:

First of all, you need to export from Scrivener with the correct format. Scrivener doesn’t export any special style information, so we will be using a special bit of title suffix text to tell Word which parts of the text are your headings.

The macro can support 6 levels of headingsThe suffixes are in this format:

  1. ~#~ (this corresponds to what you want as Heading 1 in Word)
  2. ~##~ (Heading 2)
  3. ~###~ (Heading 3 …etc…)
  4. ~####~
  5. ~#####~
  6. ~######~

Go to File > Compile, and set up your headings to have a suffix. For Heading 1 it will look like this:

The exported Word document will look something like this:

Title ~#~

Chapter 1 ~##~

It was a dark and stormy night; the rain fell in torrents, except at occasional intervals, when it was checked by a violent gust of wind which swept up the streets (for it is in London that our scene lies), rattling along the house-tops, and fiercely agitating the scanty flame of the lamps that struggled against the darkness.

Chapter 2 – A Story in 3 Parts ~##~

Part 1 ~###~

Through one of the obscurest quarters of London, and among haunts little loved by the gentlemen of the police, a man, evidently of the lowest orders, was wending his solitary way. He stopped twice or thrice at different shops and houses of a description correspondent with the appearance of the quarter in which they were situated, and tended inquiry for some article or another which did not seem easily to be met with.

Part 2 ~###~

All the answers he received were couched in the negative; and as he turned from each door he muttered to himself, in no very elegant phraseology, his disappointment and discontent. At length, at one house, the landlord, a sturdy butcher, after rendering the same reply the inquirer had hitherto received, added, “But if this vill do as vell, Dummie, it is quite at your sarvice!”

You can see how the headings are unstyled, but they have the special suffix added.

Create a macro in your document, and paste this code in:

Set the macro to either a keyboard shortcut, or put a custom button on your toolbar.

Go through your book maybe 3-4 pages at a time. Select the text, then run the macro. Only do a few pages at a time, otherwise the macro will fail.

It shouldn’t take you too long to do the whole book at that speed, and then you’re done!

One thought on “How to export from Scrivener to Word with correct styles

  1. Alan, Thanks for this post which is helping with conversion to Word.

    A couple of points to help the performance of the code (and what might be the cause of the failures you’ve observed).

    1. Currently, this defines ‘oWord’ for each paragraph (line 46) thereby reserving extra memory each paragraph. Move this ‘Dim’ to the top of the function (under line 30) as it is only needed to reserve memory for that variable once.
    2. When running in a long loop, it’s necessary to ‘yield’ to the operating system, otherwise it thinks that things have crashed. Easiest way to do this is to add a ‘DoEvents’ statement immediately before the final ‘Next’ around line 66.

    Hope this helps.

Leave a Reply

Your email address will not be published. Required fields are marked *