UseModWiki | RecentChanges | Preferences

This is a macro for Microsoft Word that helps you convert Word documents into UseMod pages.


  1. Launch Microsoft Word, go to Tools | Macro | Visual Basic Editor (Alt+F11)
  2. right mouse button on the Normal project (within the Project Explorer window - if you don't see that window, go View | Project Explorer (Ctrl-R)), do an Insert | Module
  3. Open the /source code in a new browser window
  4. copy & paste the source code into the newly created module (make sure not to take bring along wiki markup in this paste - just get the code).
  5. go File | Save Normal, then File | Close and Return to Microsoft Word


  1. From any Word document, go </b>Tools | Macro | Macros... </b> (Alt+F8) and run the "WordToUseModWiki?" macro - the text of the document is converted (in-place) and copied to the clipboard.
  2. Paste to your UseModWiki page


It handles conversions for the following:


by PritishJacob adapted from a [TikiWiki] [extension] by [swythan]


This looks a useful basis for converting Word documents to wiki.

I have always advocated linking to existing Word documents rather than duplicating the information inside the wiki except where the Word document is being replaced by the wiki page. In the later case this macro gives a useful starting point. --BrianHunter

I have added processing for table of contents...

Instructions to add TOC processing to the macro

 add a call to ConvertTOC? after the H1/H2/H3 calls
 change the headings to be numbered headings
i.e. include a #
    .InsertBefore? "== # "
    .InsertAfter? " =="
 make the headings 1 level less (as heading 1 is not included in a TOC)
i.e. heading 1 becomes heading 2; heading 2 becomes heading 3 etc
 add this subroutine at the end of the macro
Private Sub ConvertTOC()
    With Selection.Find
        .Text = "Table of Contents"
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
        .Forward = True
        .Wrap = wdFindContinue
        Do While .Execute
            With Selection
                If InStr(1, .Text, vbCr) Then
                    ' Just process the chunk before any newline characters
                    ' We'll pick-up the rest with the next search
                    .MoveEndUntil vbCr
                End If
                ' Don't bother to markup newline characters (prevents a loop, as well)
                If Not .Text = vbCr Then
                    .InsertBefore "<b>" 
                    .InsertAfter "</b><toc>" 
                    .Font.Bold = False
                    Exit Do
                End If

            End With
    End With
End Sub

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited February 1, 2013 5:31 pm by JuanmaMP (diff)