Code Converter
Sub ColorCodetoWiki()
'
' This macro is a modification of ColorCodetoCSS
'
' Original ColorCodetoCSS by:          Ceradel
' Date started:                 February 12th, 2008
' Date of update taken:     February 17th, 2008
' Modified by:              Ceradel
' Date of current code:         December 7th, 2008
'
'
' Purpose:
' Used to prepare a selection of Sharune color codes to be pasted into an
' wiki page using css classes to recognize the standard colors.
'
' Limitations:
' Currently cannot convert background colors
'
'
'   Part One
'   Convert standard colors to wiki span tags with css classes
'
'
' Begin at the start of the text and prevent being disrupted by
' starting with text selected
'
Selection.HomeKey Unit:=wdStory
'
' Get rid of those stupid "smart quotes"
'
With Options
    .AutoFormatAsYouTypeReplaceQuotes = False
    .AutoFormatReplaceQuotes = False
    .PasteAdjustWordSpacing = False
End With
'
' Convert red color range to html tags
'
    With Selection.Find
        .Text = "&R"
        .Replacement.Text = "[[/span]][[span class=""br""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&r"
        .Replacement.Text = "[[/span]][[span class=""r""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r9"
        .Replacement.Text = "[[/span]][[span class=""pr9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r8"
        .Replacement.Text = "[[/span]][[span class=""pr8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r7"
        .Replacement.Text = "[[/span]][[span class=""pr7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r6"
        .Replacement.Text = "[[/span]][[span class=""pr6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r5"
        .Replacement.Text = "[[/span]][[span class=""pr5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r4"
        .Replacement.Text = "[[/span]][[span class=""pr4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r3"
        .Replacement.Text = "[[/span]][[span class=""pr3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r2"
        .Replacement.Text = "[[/span]][[span class=""pr2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+r1"
        .Replacement.Text = "[[/span]][[span class=""pr1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r9"
        .Replacement.Text = "[[/span]][[span class=""nr9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r8"
        .Replacement.Text = "[[/span]][[span class=""nr8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r7"
        .Replacement.Text = "[[/span]][[span class=""nr7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r6"
        .Replacement.Text = "[[/span]][[span class=""nr6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r5"
        .Replacement.Text = "[[/span]][[span class=""nr5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r4"
        .Replacement.Text = "[[/span]][[span class=""nr4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r3"
        .Replacement.Text = "[[/span]][[span class=""nr3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r2"
        .Replacement.Text = "[[/span]][[span class=""nr2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-r1"
        .Replacement.Text = "[[/span]][[span class=""nr1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert green color range to html tags
'
    With Selection.Find
        .Text = "&G"
        .Replacement.Text = "[[/span]][[span class=""bg""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&g"
        .Replacement.Text = "[[/span]][[span class=""g""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g9"
        .Replacement.Text = "[[/span]][[span class=""pg9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g8"
        .Replacement.Text = "[[/span]][[span class=""pg8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g7"
        .Replacement.Text = "[[/span]][[span class=""pg7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g6"
        .Replacement.Text = "[[/span]][[span class=""pg6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g5"
        .Replacement.Text = "[[/span]][[span class=""pg5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g4"
        .Replacement.Text = "[[/span]][[span class=""pg4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g3"
        .Replacement.Text = "[[/span]][[span class=""pg3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g2"
        .Replacement.Text = "[[/span]][[span class=""pg2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+g1"
        .Replacement.Text = "[[/span]][[span class=""pg1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g9"
        .Replacement.Text = "[[/span]][[span class=""ng9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g8"
        .Replacement.Text = "[[/span]][[span class=""ng8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g7"
        .Replacement.Text = "[[/span]][[span class=""ng7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g6"
        .Replacement.Text = "[[/span]][[span class=""ng6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g5"
        .Replacement.Text = "[[/span]][[span class=""ng5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g4"
        .Replacement.Text = "[[/span]][[span class=""ng4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g3"
        .Replacement.Text = "[[/span]][[span class=""ng3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g2"
        .Replacement.Text = "[[/span]][[span class=""ng2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-g1"
        .Replacement.Text = "[[/span]][[span class=""ng1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert yellow color range to html tags
'
    With Selection.Find
        .Text = "&Y"
        .Replacement.Text = "[[/span]][[span class=""by""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&y"
        .Replacement.Text = "[[/span]][[span class=""y""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y9"
        .Replacement.Text = "[[/span]][[span class=""py9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y8"
        .Replacement.Text = "[[/span]][[span class=""py8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y7"
        .Replacement.Text = "[[/span]][[span class=""py7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y6"
        .Replacement.Text = "[[/span]][[span class=""py6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y5"
        .Replacement.Text = "[[/span]][[span class=""py5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y4"
        .Replacement.Text = "[[/span]][[span class=""py4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y3"
        .Replacement.Text = "[[/span]][[span class=""py3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y2"
        .Replacement.Text = "[[/span]][[span class=""py2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+y1"
        .Replacement.Text = "[[/span]][[span class=""py1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y9"
        .Replacement.Text = "[[/span]][[span class=""ny9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y8"
        .Replacement.Text = "[[/span]][[span class=""ny8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y7"
        .Replacement.Text = "[[/span]][[span class=""ny7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y6"
        .Replacement.Text = "[[/span]][[span class=""ny6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y5"
        .Replacement.Text = "[[/span]][[span class=""ny5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y4"
        .Replacement.Text = "[[/span]][[span class=""ny4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y3"
        .Replacement.Text = "[[/span]][[span class=""ny3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y2"
        .Replacement.Text = "[[/span]][[span class=""ny2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-y1"
        .Replacement.Text = "[[/span]][[span class=""ny1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert blue color range to html tags
'
    With Selection.Find
        .Text = "&B"
        .Replacement.Text = "[[/span]][[span class=""bb""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&b"
        .Replacement.Text = "[[/span]][[span class=""b""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b9"
        .Replacement.Text = "[[/span]][[span class=""pb9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b8"
        .Replacement.Text = "[[/span]][[span class=""pb8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b7"
        .Replacement.Text = "[[/span]][[span class=""pb7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b6"
        .Replacement.Text = "[[/span]][[span class=""pb6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b5"
        .Replacement.Text = "[[/span]][[span class=""pb5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b4"
        .Replacement.Text = "[[/span]][[span class=""pb4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b3"
        .Replacement.Text = "[[/span]][[span class=""pb3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b2"
        .Replacement.Text = "[[/span]][[span class=""pb2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+b1"
        .Replacement.Text = "[[/span]][[span class=""pb1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b9"
        .Replacement.Text = "[[/span]][[span class=""nb9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b8"
        .Replacement.Text = "[[/span]][[span class=""nb8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b7"
        .Replacement.Text = "[[/span]][[span class=""nb7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b6"
        .Replacement.Text = "[[/span]][[span class=""nb6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b5"
        .Replacement.Text = "[[/span]][[span class=""nb5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b4"
        .Replacement.Text = "[[/span]][[span class=""nb4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b3"
        .Replacement.Text = "[[/span]][[span class=""nb3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b2"
        .Replacement.Text = "[[/span]][[span class=""nb2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-b1"
        .Replacement.Text = "[[/span]][[span class=""nb1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
'Convert magenta color range to html tags
'
    With Selection.Find
        .Text = "&M"
        .Replacement.Text = "[[/span]][[span class=""bm""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&m"
        .Replacement.Text = "[[/span]][[span class=""m""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m9"
        .Replacement.Text = "[[/span]][[span class=""pm9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m8"
        .Replacement.Text = "[[/span]][[span class=""pm8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m7"
        .Replacement.Text = "[[/span]][[span class=""pm7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m6"
        .Replacement.Text = "[[/span]][[span class=""pm6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m5"
        .Replacement.Text = "[[/span]][[span class=""pm5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m4"
        .Replacement.Text = "[[/span]][[span class=""pm4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m3"
        .Replacement.Text = "[[/span]][[span class=""pm3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m2"
        .Replacement.Text = "[[/span]][[span class=""pm2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+m1"
        .Replacement.Text = "[[/span]][[span class=""pm1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m9"
        .Replacement.Text = "[[/span]][[span class=""nm9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m8"
        .Replacement.Text = "[[/span]][[span class=""nm8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m7"
        .Replacement.Text = "[[/span]][[span class=""nm7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m6"
        .Replacement.Text = "[[/span]][[span class=""nm6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m5"
        .Replacement.Text = "[[/span]][[span class=""nm5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m4"
        .Replacement.Text = "[[/span]][[span class=""nm4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m3"
        .Replacement.Text = "[[/span]][[span class=""nm3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m2"
        .Replacement.Text = "[[/span]][[span class=""nm2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-m1"
        .Replacement.Text = "[[/span]][[span class=""nm1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert cyan color range to html tags
'
    With Selection.Find
        .Text = "&C"
        .Replacement.Text = "[[/span]][[span class=""bc""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&c"
        .Replacement.Text = "[[/span]][[span class=""c""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c9"
        .Replacement.Text = "[[/span]][[span class=""pc9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c8"
        .Replacement.Text = "[[/span]][[span class=""pc8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c7"
        .Replacement.Text = "[[/span]][[span class=""pc7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c6"
        .Replacement.Text = "[[/span]][[span class=""pc6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c5"
        .Replacement.Text = "[[/span]][[span class=""pc5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c4"
        .Replacement.Text = "[[/span]][[span class=""pc4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c3"
        .Replacement.Text = "[[/span]][[span class=""pc3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c2"
        .Replacement.Text = "[[/span]][[span class=""pc2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+c1"
        .Replacement.Text = "[[/span]][[span class=""pc1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c9"
        .Replacement.Text = "[[/span]][[span class=""nc9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c8"
        .Replacement.Text = "[[/span]][[span class=""nc8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c7"
        .Replacement.Text = "[[/span]][[span class=""nc7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c6"
        .Replacement.Text = "[[/span]][[span class=""nc6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c5"
        .Replacement.Text = "[[/span]][[span class=""nc5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c4"
        .Replacement.Text = "[[/span]][[span class=""nc4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c3"
        .Replacement.Text = "[[/span]][[span class=""nc3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c2"
        .Replacement.Text = "[[/span]][[span class=""nc2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-c1"
        .Replacement.Text = "[[/span]][[span class=""nc1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert black color range to html tags
'
    With Selection.Find
        .Text = "&K"
        .Replacement.Text = "[[/span]][[span class=""bk""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&k"
        .Replacement.Text = "[[/span]][[span class=""k""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k9"
        .Replacement.Text = "[[/span]][[span class=""pk9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k8"
        .Replacement.Text = "[[/span]][[span class=""pk8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k7"
        .Replacement.Text = "[[/span]][[span class=""pk7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k6"
        .Replacement.Text = "[[/span]][[span class=""pk6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k5"
        .Replacement.Text = "[[/span]][[span class=""pk5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k4"
        .Replacement.Text = "[[/span]][[span class=""pk4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k3"
        .Replacement.Text = "[[/span]][[span class=""pk3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k2"
        .Replacement.Text = "[[/span]][[span class=""pk2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+k1"
        .Replacement.Text = "[[/span]][[span class=""pk1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k9"
        .Replacement.Text = "[[/span]][[span class=""nk9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k8"
        .Replacement.Text = "[[/span]][[span class=""nk8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k7"
        .Replacement.Text = "[[/span]][[span class=""nk7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k6"
        .Replacement.Text = "[[/span]][[span class=""nk6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k5"
        .Replacement.Text = "[[/span]][[span class=""nk5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k4"
        .Replacement.Text = "[[/span]][[span class=""nk4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k3"
        .Replacement.Text = "[[/span]][[span class=""nk3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k2"
        .Replacement.Text = "[[/span]][[span class=""nk2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-k1"
        .Replacement.Text = "[[/span]][[span class=""nk1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert white color range to html tags
'
    With Selection.Find
        .Text = "&W"
        .Replacement.Text = "[[/span]][[span class=""bw""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&w"
        .Replacement.Text = "[[/span]][[span class=""w""]]"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w9"
        .Replacement.Text = "[[/span]][[span class=""pw9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w8"
        .Replacement.Text = "[[/span]][[span class=""pw8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w7"
        .Replacement.Text = "[[/span]][[span class=""pw7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w6"
        .Replacement.Text = "[[/span]][[span class=""pw6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w5"
        .Replacement.Text = "[[/span]][[span class=""pw5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w4"
        .Replacement.Text = "[[/span]][[span class=""pw4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w3"
        .Replacement.Text = "[[/span]][[span class=""pw3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w2"
        .Replacement.Text = "[[/span]][[span class=""pw2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&+w1"
        .Replacement.Text = "[[/span]][[span class=""pw1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w9"
        .Replacement.Text = "[[/span]][[span class=""nw9""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w8"
        .Replacement.Text = "[[/span]][[span class=""nw8""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w7"
        .Replacement.Text = "[[/span]][[span class=""nw7""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w6"
        .Replacement.Text = "[[/span]][[span class=""nw6""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w5"
        .Replacement.Text = "[[/span]][[span class=""nw5""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w4"
        .Replacement.Text = "[[/span]][[span class=""nw4""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w3"
        .Replacement.Text = "[[/span]][[span class=""nw3""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w2"
        .Replacement.Text = "[[/span]][[span class=""nw2""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
        .Text = "&-w1"
        .Replacement.Text = "[[/span]][[span class=""nw1""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Convert normal tag to an html tag
'
    With Selection.Find
        .Text = "&n"
        .Replacement.Text = "[[/span]][[span class=""n""]]"
        .MatchCase = False
        .Execute Replace:=wdReplaceAll
    End With
'
' Finish converting the greater than angle bracket to
' a character entity
'
    With Selection.Find
        .Text = "&t;"
        .Replacement.Text = ">"
        .MatchCase = True
        .Execute Replace:=wdReplaceAll
    End With
'
'
'   Part Two
'   Convert custom RGB colors to html font tags
'
'
' A while loop that will find the tag for each custom rgb color (&x)
' and replace the color with hex values and create the html tags
'
Dim finishtest As String
Dim decred As Integer, decgre As Integer, decblu As Integer
Dim hexred As String * 2, hexgre As String * 2, hexblu As String * 2
Dim hexcode As String * 6
'
' Start at the begining to prevent a selection causing a problem
'
Selection.HomeKey Unit:=wdStory
'
With Selection.Find
    .Text = "&x"
End With
'
Selection.Find.Execute
'
' The finishtest variable is used to determine when all custom colors
' have been converted into html tags by testing if there are still &x
' tags present.
'
finishtest = Selection.Range
'
Do While finishtest = "&x"
    '
    ' Break the custom color code into it's three main parts, the red
    ' value, the green value, and the blue value.
    '
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
    decred = Selection.Range
    '
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
    decgre = Selection.Range
    '
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdCharacter, Count:=3, Extend:=wdExtend
    decblu = Selection.Range
    '
    ' Delete the remnants of the decimal numbers so they don't clutter
    ' the finished conversion.
    '
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveLeft Unit:=wdCharacter, Count:=9, Extend:=wdExtend
    Selection.Delete
    '
    ' As each of the original values are decimal numbers and html uses
    ' hexadecimal numbers, they must each be converted.
    '
    hexred = Right("00" & Hex(decred), 2)
    '
    hexgre = Right("00" & Hex(decgre), 2)
    '
    hexblu = Right("00" & Hex(decblu), 2)
    '
    ' Join each hexadecimal value into a string to make insertion easier.
    '
    hexcode = hexred & hexgre & hexblu
    '
    ' Replace the &x tags with the html code containing the newly found
    ' color value.
    '
    Selection.HomeKey Unit:=wdStory
    '
    With Selection.Find
        .Text = "&x"
        .Replacement.Text = "[[/span]][[span style=""color:#hexcode""]]"
        .Execute Replace:=wdReplaceOne
    End With
    '
    With Selection.Find
        .Text = "hexcode"
        .Replacement.Text = hexcode
        .Execute Replace:=wdReplaceOne
    End With
    '
    ' Find the next &x tag, if none are found the loop will finish and
    ' exit to the next part of the converter.
    '
    Selection.HomeKey Unit:=wdStory
    '
    With Selection.Find
        .Text = "&x"
        .Execute
    End With
    '
    finishtest = Selection.Range
    '
Loop
'
    With Selection.Find
        .Text = "   Affects:"
        .Replacement.Text = "[[/span]][[span class=""af""]]Affects:"
        .Execute Replace:=wdReplaceAll
    End With
'
'
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
        .Text = "[[/span]]"
        .Forward = True
    End With
    Selection.Find.Execute
    Selection.Cut
    Selection.EndKey Unit:=wdStory
    Selection.Paste
'
'
    Selection.HomeKey Unit:=wdStory
    With Selection.Find
        .Text = "Object '[[/span]]"
        .Replacement.Text = "Object '"
        .Forward = True
        .Execute Replace:=wdReplaceAll
    End With
'
' And this concludes the converter.
'
' Currently the output of this is being used at http://icbms.wikidot.com/
'
End Sub
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License