Scrivener to Word Visual Basic Formatter – Converting Scrivener to Word with Style

So I have said previously that one of the issues I have had with using Scrivener to write with is also one of its strengths:  Scrivener doesn’t do formatting. It separates the formatting of the word from the writing of the word. The idea is, you write your Great Australian Novel in Scrivener, and then when it is all done and dusted you compile and format it in Word.  But when you format, you want styles and you want them now.  In Word, styles allow the Table of Contents to be generated (Scrivener has one, but, yeah).  

It is a real pain with Scrivener trying to maintain a master manuscript but working with others who want to see your work in Word.  Particularly when you format the document up in Word, and then move sub-section 1.1 to become 1.3, that can wreck your whole weekend.  You will want to make the change in your master, and in the formatted version of the document.

Wouldn’t it be nice to be able to generate formats up quickly? Take your Scrivener document and publish it to Word, and then format it quickly to enable styles and such, in about 30 seconds?

Well I had seen where people suggested you use use a specific font size in your Scrivener document for headings and then search and replace using styles in Word.  If you do that, your headings will quickly be able to be moved to become styles.  But it’s still tedious.

So where’s all this going?  Today I wrote a Word visual basic macro that converts an RTF version of the document to a Word version with styles.  Now, it’s still rough.  It’s not polished, and no doubt it’s buggy – so although I am sharing it in this post, please don’t use it with the only copy of your thesis!!! 

So here’s what I’ve done:

  • It’s a single document (download scrivener-formatter.docm using this finely crafted link) that should run in Word for Mac 2011 (presumably, Word 2007 or later – but if you’re on Windows, I don’t know that you’d be likely to be on Scrivener – but maybe you are).
  • There are five styles in this document (Heading 1, 2, 3 & 4, as well as Header).  They are fairly standard thesis-style formats at the moment – but if you download this document, and modify the styles, those styles will stick with the document.  So modifying Heading 1 to be Arial rather than Times New Roman is done the same as it always has been – and when you save this document it will be the new style it applies for Heading 1.
  • To use, compile your Scrivener document to RTF and open it up in Word (if you are using EndNote, format the paper to add the citations in).  
  • Open up the scrivener-formatter document in Word, and copy -and-paste (I know, but I did you tell you it’s still rough) your compiled RTF into the scrivener-formatter document.
  • When you open up the scrivener-formatter document it should warn you that has a macro in it – well that’s fine; check out the macro (source code is included) to be sure if you like.  I attach the macro to a button on the toolbar.  You may wish to do the same.
  • The macro assumes your core text will not be any larger than 12 point font.  Any font that is font size 13, 14, 16 or 18 will be mapped to the four styles according to the below:
    • Font Size 18:  This will assign style Header to the paragraph.  In the Table of Contents by default, anything assigned a style of Header will appear as if it were Heading 1.  The main difference in the document between Header and Heading 1 is that Heading 1 has a list numbering effect (currently, Heading 1 is “Chapter X:”; you can change this by modifying the style).  I created Header as I don’t use the Chapter numbering for the References heading, and I still want the References heading appearing in the Table of Contents (the same will apply for Appendix headers etc).  If you don’t want this, don’t use 18 point font.
    • Font size 16:  This is Heading 1 (I label this Heading in my Scrivener document).  Heading 1 style (currently preceded with “Chapter X:”) is TOC Level 1. Gets a section number in the current format style.
    • Font size 14:  This is Heading 2 (Scrivener:  Section Heading).  TOC 2. Gets a section number in the current format style.
    • Font size 13 (without italics):  This is Heading 3 (Scrivener:  Sub-heading).  TOC 3.  Gets a section number in the current format style.
    • Font size 13 with italics:  This is Heading 4 (Scrivener:  I label this Para Heading).  This does not appear in the TOC by default, and does not get a section number:  it’s merely a paragraph heading in italics without numbering.  
  • The macro also deletes any in-line comments in the document.  I use comments extensively, but I don’t want them in the final formatted version.  So they’re gone ski.
  • I use a placeholder for the reference list of [ENDNOTE:DELETE] to ensure formatting is properly assigned to the references generated by EndNote.  This placeholder is deleted by the macro.  If you wish, ignore this – so long as you don’t have that placeholder in your document you will be fine.
  • Finally, a Table of Contents is generated at the beginning of the document to give you a visual map and a ToC.

That’s it, all takes a very short time to run even on my current 50 page draft.  

Now although I don’t anticipate any problems, this is not extensively tested.  It seems to work fine for me, but I haven’t put it through its paces yet. Nevertheless it promises a bit of time saving. I am also toying with the idea of using placeholders for tables and having the macro look for those tables and inserting them at designated placeholders – we will have to see if I get that far.

Feedback welcome!  I hope this VB macro is of use to someone using Scrivener.   Remember you can change the fonts to suit, and it makes the document into a heading of some sort if it is font size 18, 16, 14, or 13.  

Download the Scrivener formatting Word macro document here.

Happy automatic formatting in Scrivener with Word Styes.  Please leave feedback in the comments below or by email on micheal@michealaxelsen.com if this is useful or could be improved (not that I can guarantee I’ll do it!)

4 Comments

  1. What a great idea! and workaround! I’m reading this because my friend working on her dissertation asked me for help getting the doc into Word. I’m pretty good with templates and styles. After messing around for two hours – with Word doing weird things – we finally decided that Scrivener produces a great APA6 looking doc and that it would be faster (really!) for her to create her TOC, and lists of figures and tables by hand. Perish the thought, but there it is. I hope others can use your macro and thanks for making it available.

    • I hope it is useful. Tables are still a bug-bear though, and obviously captions/referencing won’t convert to Word (which I find doesn’t work well for large documents anyway). I may update this formatter to include an Appendix header option I suspect to get the ToCs working properly.

      Thanks for the feedback.

Leave a Reply