alvarv cagetbasro This VBA macro for Microsoft word will put JSP Wiki formatting on document. The original (which required some tweaks) was found at

Added conversion of hyperlinks to the macro. The updated macro is attached as WikiMacros.bas. -Julian Sinai

Could it be extended to deal with embedded images? -NascifAbousalhNeto

Do you Have something like this for a excel file, I am sure it would really help! -Sapal

Unfortunately the files uploaded have been vandalized, so anyone got a fresh copy?

--monsoon, 25-Apr-2006


You can just download the older versions by clicking the paperclip image... Or you could restore them yourself!

-- JanneJalkanen

I put the macro in a Word 2004 for Mac template as Seems to mostly work (except for links with different display names).

--Jim White, 15-Jun-2006

Has anyone ever seen a plug-in/macro/or a process to go the other way?

I'd like to use JSPWiki to write Design Documents then export the pages into a Word Doc which could be presented to the client. If I cut and paste into Word directly, I get the Wiki's formatting which is not bad (I use the smallpiece skin) but I might need to adhere to a standard format.

-- MartinHache

I've made some changes to the macro to make it easier to use for my team. We are converting lots of project docs from Word to JSPWiki and most of the users are not programmers. The major changes are:

  • Refactored the code so it's a little easier to work with (for me, YMMV).
  • Put all the wiki formatting codes into constants. May make refactoring for other wikis easier.
  • I was uncomfortable with the macro changing the original document (too easy to destroy it), so the macro now opens a new doc, copies the original to it and performs the conversion on that. I added a line to close the new document as well, but commented it out. Uncomment the line to have the wiki text just magically appear on the clipboard.
  • I did some work to enhance table conversions. Rows that are formatted as all bold will be converted to header rows. Italics and underline should be converted correctly in tables. Line breaks should be handled correctly in cells.

I may also write a batch conversion program based on the macro. It would be the kind of thing you would point at a directory to convert all the Word files in the tree. Would anyone else be interested in something like that?

-- Jeff Grimshaw


Love the modifications/corrections you were able to make, however I think I found a bug (using MoreWikiMacros.bas(info)). Since I know nothing about VBScript, I'm hoping someone here can fix it.

There is something seriously wrong with the Bold function:

  • If Boldface is used in the middle of a paragraph, the script gets caught in a loop and crashes Word.
  • If Boldface is used at the beginning of a paragraph, it creates about 20 sets of double underline __ around the entire paragraph. This doesn't loop indefinetly, but makes a mess where none of the other scripts do.

There is also something wrong with the List Number conversion - it just plain doesn't work. My numbered lists (using just the Numbering button on the toolbar) are left behind and not converted. Am I doing something wrong with my document formatting?

Since this is the only script that does Tables correctly, I'm stuck.

Can anyone help fix this?

-- Carolinne

I ran into the same problem (stuck in loops) in a word file I was attempting to convert, so I corrected the problem. Runs fine in the file I was converting, but not tested on other Word files. Uploaded as Word2Wiki3.bas(info).


If you could create a batch converter I believe a lot of companies will thank you from the bottom of their hearts. :D. So yes please, by all means create one!

--Geoff Williams, 05-Jun-2007

Added conversion of color, code, paragraphs and pictures. The updated macro is called Word2JSPWiki.bas Notes:
  • Open the Word document
  • Select menu Tools -> Macro -> Visual Basic Editor or press Alt+F11
  • In the new window that opens select menu File -> Import File... or press Ctrl+M
  • Import the file Word2JSPWiki.bas, or open the attachment.
  • To convert the document select menu Run -> Run Macro or press F5
  • Select Word2Wiki and click Run
  • A new Word window is created named Document1. If the text in the document is not already selected press Ctrl+A to select all text and paste into the new wiki page
  • Check the wiki markup and fix if necessary.
  • Picture handling is pretty primative - will replace pictures with sequential jpeg or gif file references (image002.jpg, image004.jpg, image005.gif etc) and save a copy of the original file as html in the parent dir. From the wiki, load up the jpeg and gif files from the "<docname>_JSPWiki_files" folder and if images not too exotic, and no images are re-used, you are sweet. Otherwise, just go through and fix the references, because file number sequences will be out. Extensions (.gif or .jpg) should be good.
  • I am a techie, converting tech docs. This macro will automatically convert blocks of "Courier" and "Courier New" font to code blocks. If you don't want this - disable the ConvertCode subroutine call (add ' in front).

-T Goodwill

Checked in a new version as Word2JSPWiki_RRG.bas(info) with the following changes:

  • Added Converting BoldItalics
  • Added support for .docx (instead of just .doc files)
  • Changed line break from \\ to double space
  • Fixed Numbered lists
  • Calls the function to delete any shapes created using Word.
  • Fixed some other random things to my liking

- Rachana Gaddam, 20-Dec-2011

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
MoreWikiMacros.bas 10.9 kB 1 05-Feb-2007 05:40
WikiMacros.bas 9.1 kB 4 18-May-2006 21:41
Word2JSPWiki.bas 21.4 kB 7 21-Dec-2011 01:15 The original version 4 from TGoodWill, 26-Jun-2009 with note: Revised to convert
dot 50.2 kB 1 15-Jun-2006 05:54 Jim White
Word2JSPWiki_RRG.bas 25.6 kB 1 21-Dec-2011 01:11 Rachana Gaddam: Few fixes
Word2JSPWiki_fixed_numberedLis... 8.7 kB 1 25-Jan-2007 16:11 Word 2 JSPWiki macro with fixed Numbered lists
Word2Wiki3.bas 11.4 kB 1 08-Aug-2007 19:57 Added v3
myFile.doc 24.1 kB 2 11-Aug-2009 10:57
« This page (revision-45) was last changed on 21-Dec-2011 01:20 by