Macro to convert Word to Wiki?

P

pjs

I need to convert a number of Word documents for use on a Wiki. I would like
to create a macro to search for bolded text, place <b> before and </b> after
each instance, debold, then do similar things for italics, superscripts,
subscripts, small caps, etc.

Is this possible? Straightforward? I'm pretty new to creating macros using
VBA.

Thanks,

pjs
 
D

Doug Robbins - Word MVP

Use:

Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.Font.Bold = True
With Selection.Find
Do While .Execute(findText:="", Forward:=True, _
MatchWildcards:=False, MatchCase:=True, Wrap:=wdFindContinue) =
True
Set myrange = Selection.Range
With myrange
.InsertBefore "<b>"
.InsertAfter "</b>"
.Font.Bold = False
.Collapse wdCollapseEnd
End With
Loop
End With

modified as required for the other attributes.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top