Public la(), la1(), pre(), suf() As String Public ltype() As Integer Public string1(), charcode(), charcode1() As String Public MainListcount, maxim, MaxBullLNo As Integer Public tabletest, other1 As Integer Public myrange As Range Sub WithOutListStyle1() 'ReDim Preserve vxarArray(UBound(varArray) + 10) On Error Resume Next err.Description = "" 'On Error GoTo ERROR_ROUTINE With options .ReplaceSelection = True End With Dim ListNo, ListNo1 ListNo = 0 ListNo1 = 0 Dim exPcount, exLcount Dim UL11 UL11 = 0 'Call tabremove Call mullist Call table_enter Call InitialCleanup 'ActiveDocument.Range.ListFormat.ConvertNumbersToText fieldcodevalue = 0 Set myrange = ActiveDocument.Range myrange.find.ClearFormatting myrange.find.Replacement.ClearFormatting myrange.find.Execute findtext:="\", MatchWildcards:=True, Forward:=True Do While myrange.find.found myrange.Select Dim aField As Field Dim fieldRange As Range 'Dim fieldcount 'fieldcount = Selection.Range.Fields.Count 'For Each aField In ActiveDocument.Fields For Each aField In Selection.Range.Fields Select Case aField.Type Case 53 Set fieldRange = aField.Code aField.Select Selection.Range.HighlightColorIndex = wdYellow fieldcodevalue = 1 Case 54 Set fieldRange = aField.Code aField.Select Selection.Range.HighlightColorIndex = wdYellow fieldcodevalue = 1 Case 89 Set fieldRange = aField.Code aField.Select Selection.Range.HighlightColorIndex = wdYellow fieldcodevalue = 1 Case 90 Set fieldRange = aField.Code aField.Select Selection.Range.HighlightColorIndex = wdYellow fieldcodevalue = 1 End Select Next myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="^t^p", replacewith:="^t ^p", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceOne, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="= 1 Then 'For ul1 = 1 To exPcount 'If myrange.Paragraphs(ul1).Range.Style = "UL" Then 'UL11 = 1 'Exit For 'End If 'Next 'End If 'If UL11 = 1 Or exLcount >= 1 Then 'for lcount >=1 & ul should present 'UL11 = 0 myrange.Select Call DoubleEnter Call ListTypeArray Call InnerList paracheck = 0 For i = 2 To MainListcount - 1 If la(i) <> "" Then paracheck = 1 Exit For End If Next If paracheck = 0 Then myrange.Select Dim notrange As Range Set notrange = Selection.Range notrange.Select notrange.find.ClearFormatting notrange.find.Replacement.ClearFormatting notrange.find.Execute findtext:="=1 & ul should present End If 'paracheck 'Set myrange = ActiveDocument.Range(Selection.Range.End, ActiveDocument.Range.End) Set myrange = ActiveDocument.Range myrange.find.ClearFormatting myrange.find.Replacement.ClearFormatting myrange.find.Execute findtext:="\", MatchWildcards:=True, Forward:=True Loop Call cleanup2 Call FinalCleanup Call newlistcleanup Call mullistproc '''''MsgBox "Conversion Completed.", vbInformation, "List Conversion" 'ERROR_ROUTINE: ' If err.Description <> "" Then ' MsgBox err.Description, vbCritical, "Error Message" ' End ' End If End Sub Sub ParallelList() Dim pararange As Range For i = 2 To MainListcount - 1 myrange.Paragraphs(i).Range.Select Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:="[~PL~]", MatchWildcards:=False, Forward:=True pararange.Select If pararange.find.found Then If Selection.text = "[~PL~]" Then Selection.Delete Unit:=wdCharacter, count:=1 End If ltype(i) = ltype(i - 1) - 1 la(i) = "PL" End If Next End Sub Sub itemclear() For ii = 1 To MainListcount If la1(ii) <> "" Then ltype(ii) = 0 End If Next End Sub Sub InnerList() Dim pararange1, Lpara2 ReDim Lpara(5000) Dim pararange, Tabrange, innerrange As Range Dim varRegex3 As New RegExp ' Declaration for regexp Dim varMatch3 As Match Dim varMatchs3 As MatchCollection varRegex3.Pattern = "Other([0-9])" Dim varRegex As New RegExp ' Declaration for regexp Dim varMatch As Match Dim varMatchs As MatchCollection varRegex.Pattern = "\[L([0-9]{1,})\]" & Chr(13) Dim varRegex1 As New RegExp ' Declaration for regexp Dim varMatch1 As Match Dim varMatchs1 As MatchCollection varRegex1.Pattern = "\[/L([0-9]{1,})\]" & Chr(13) Lpara2 = 1 myrange.Select MainListcount = Selection.Range.Paragraphs.count MaxBullLNo = 0 For i = 2 To MainListcount - 1 myrange.Paragraphs(i).Range.Select Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:="\[L([0-9]{1,})\]", MatchWildcards:=True, Forward:=True pararange.Select If pararange.find.found Then 'ListStyle1(i) = Selection.Text Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:="([0-9]{1,})", MatchWildcards:=True, Forward:=True If pararange.find.found Then pararange.Select If val(Selection.text) > MaxBullLNo Then MaxBullLNo = Selection.text End If End If End If Next 'for inner bulleted list If MaxBullLNo >= 1 Then Dim Lparacount Dim seltext For i = MaxBullLNo To 1 Step -1 myrange.Select Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:="\[L" & i & "\](*)\[/L" & i & "\]", MatchWildcards:=True, Forward:=True If pararange.find.found Then pararange.Select Set pararange1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange1.find.ClearFormatting pararange1.find.Replacement.ClearFormatting pararange1.find.Execute findtext:="\[L" & i & "\]", replacewith:="", replace:=wdReplaceOne, MatchWildcards:=True, Forward:=True pararange.Select Set pararange1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange1.find.ClearFormatting pararange1.find.Replacement.ClearFormatting pararange1.find.Execute findtext:="\[/L" & i & "\]", replacewith:="", replace:=wdReplaceOne, MatchWildcards:=True, Forward:=True pararange.Select Lparacount = Selection.Range.Paragraphs.count For j = 1 To Lparacount pararange.Paragraphs(j).Range.Select Set Tabrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) Tabrange.find.ClearFormatting Tabrange.find.Replacement.ClearFormatting Tabrange.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If Tabrange.find.found Then 'find.found Tabrange.Select Set innerrange = ActiveDocument.Range(Selection.Range.End, Selection.Range.End + 6) innerrange.Select If Selection.text <> "[INNER" Then Selection.InsertBefore "[INNER" & i & "]" Selection.font.name = "Times New Roman" End If Else If Selection.Range.style = "UL" Then Tabrange.Select Set innerrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.Start + 6) innerrange.Select If Selection.text <> "[INNER" Then Selection.InsertBefore "[INNER" & i & "]" Selection.font.name = "Times New Roman" End If End If End If Next End If Next For i = 2 To MainListcount - 1 myrange.Paragraphs(i).Range.Select Set Tabrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) Tabrange.find.ClearFormatting Tabrange.find.Replacement.ClearFormatting Tabrange.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If Tabrange.find.found Then 'find.found Tabrange.Select Set innerrange = ActiveDocument.Range(Selection.Range.End, Selection.Range.End + 6) innerrange.Select If Selection.text = "[INNER" Then Selection.MoveRight Unit:=wdCharacter, count:=1 Selection.MoveRight Unit:=wdCharacter, count:=1, Extend:=wdExtend seltext = Selection.text If Selection.Range.style = "UL" Then la(i) = "UL" & Selection.text ElseIf la(i) = "Round" Or la(i) = "Disc" Or la(i) = "Square" Or la(i) = "Ndash" Or la(i) = "Mdash" Or varRegex3.test(la(i)) = True Then la(i) = "Other" & Selection.text Else la(i) = la(i) & Selection.text End If myrange.Paragraphs(i).Range.Select Set innerrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) innerrange.find.ClearFormatting innerrange.find.Replacement.ClearFormatting innerrange.find.Execute findtext:="\[INNER" & seltext & "\]", replacewith:="", replace:=wdReplaceOne, MatchWildcards:=True, Forward:=True End If Else If Selection.Range.style = "UL" Then myrange.Paragraphs(i).Range.Select Set innerrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.Start + 6) innerrange.Select If Selection.text = "[INNER" Then Selection.MoveRight Unit:=wdCharacter, count:=1 Selection.MoveRight Unit:=wdCharacter, count:=1, Extend:=wdExtend seltext = Selection.text If Selection.Range.style = "UL" Then la(i) = "UL" & Selection.text End If myrange.Paragraphs(i).Range.Select Set innerrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) innerrange.find.ClearFormatting innerrange.find.Replacement.ClearFormatting innerrange.find.Execute findtext:="\[INNER" & seltext & "\]", replacewith:="", replace:=wdReplaceOne, MatchWildcards:=True, Forward:=True End If End If End If Next End If End Sub Sub ListTypeArray() Dim rDcm1 As Range myrange.Select MainListcount = Selection.Range.Paragraphs.count ReDim string1(5000), charcode(5000), charcode1(5000) For i = 2 To MainListcount - 1 'to store character code myrange.Paragraphs(i).Range.Select Set rDcm1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) rDcm1.find.ClearFormatting rDcm1.find.Replacement.ClearFormatting rDcm1.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If rDcm1.find.found Then rDcm1.Select Set selectrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) selectrange.Select diff = Selection.Range.End - Selection.Range.Start charcode(i) = AscW(Selection.text) string1(i) = Selection.Range End If Next 'to store character code For i = 2 To MainListcount - 1 'to store char code text after (,[ If charcode(i) = 40 Or charcode(i) = 91 Then myrange.Paragraphs(i).Range.Select Set rDcm1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) rDcm1.find.ClearFormatting rDcm1.find.Replacement.ClearFormatting rDcm1.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True rDcm1.Select Set selectrange = ActiveDocument.Range(Selection.Range.Start + 1, Selection.Range.Start + 2) selectrange.Select charcode1(i) = AscW(Selection.text) End If Next 'to store char code text after (,[ For i = 2 To MainListcount - 1 'to store the listtype LA myrange.Paragraphs(i).Range.Select If la(i) = "" Then 'LA empty If Selection.Range.style = "UL" Then 'UL la(i) = "UL" End If If Selection.Range.style <> "UL" Then '<>UL Set rDcm1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) rDcm1.find.ClearFormatting rDcm1.find.Replacement.ClearFormatting rDcm1.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If rDcm1.find.found Then 'find.found rDcm1.Select Set selectrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) selectrange.Select diff = Selection.Range.End - Selection.Range.Start 'Arabic If charcode(i) >= 48 And charcode(i) <= 57 Then 'check its a number If diff = 1 Then 'if its a single digit la(i) = "Arabic" Else 'if its a single digit If left(Selection.Range, 1) <> "(" And right(Selection.Range, 1) = ")" Then la(i) = "Arabic)" suf(i) = ")" ElseIf left(Selection.Range, 1) <> "[" And right(Selection.Range, 1) = "]" Then la(i) = "Arabic]" suf(i) = "]" ElseIf right(Selection.Range, 1) = "." Then la(i) = "Arabic." suf(i) = "." Else la(i) = "Arabic" End If End If 'if its a single digit End If 'check its a number 'UALPHA If charcode(i) >= 65 And charcode(i) <= 90 Then 'diff=1 apply ualpha If diff = 1 Then 'if diff=1 If charcode(i) = 73 Or charcode(i) = 86 Or charcode(i) = 88 Then 'diff its a uroman or ualpha If charcode(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If If charcode(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If If charcode(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If Else la(i) = "UAlpha" End If End If End If 'diff=1 apply ualpha If charcode(i) >= 65 And charcode(i) <= 90 Then 'diff>1 check ualpha ( If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "(" And right(Selection.Range, 1) = ")" Then 'check ) If charcode(i) = 73 Or charcode(i) = 86 Or charcode(i) = 88 Then 'check uroman or ualpha If charcode(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha)" suf(i) = ")" Else la(i) = "URoman)" suf(i) = ")" End If End If If charcode(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha)" suf(i) = ")" Else la(i) = "URoman)" suf(i) = ")" End If End If If charcode(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha)" suf(i) = ")" Else la(i) = "URoman)" suf(i) = ")" End If End If Else la(i) = "UAlpha)" suf(i) = ")" End If End If End If End If If charcode(i) >= 65 And charcode(i) <= 90 Then 'diff>1 check ualpha [ If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "[" And right(Selection.Range, 1) = "]" Then 'check ] If charcode(i) = 73 Or charcode(i) = 86 Or charcode(i) = 88 Then 'check uroman or ualpha If charcode(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha]" suf(i) = "]" Else la(i) = "URoman]" suf(i) = "]" End If End If If charcode(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha]" suf(i) = "]" Else la(i) = "URoman]" suf(i) = "]" End If End If If charcode(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha]" suf(i) = "]" Else la(i) = "URoman]" suf(i) = "]" End If End If Else 'If Left(Selection.Range, 1) <> "(" And Right(Selection.Range, 1) = ")" Then 'check ) la(i) = "UAlpha]" suf(i) = "]" End If End If End If End If If charcode(i) >= 65 And charcode(i) <= 90 Then 'diff>1 check ualpha . If diff > 1 Then 'if diff>1 If right(Selection.Range, 1) = "." Then 'check . If charcode(i) = 73 Or charcode(i) = 86 Or charcode(i) = 88 Then 'check uroman or ualpha If charcode(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha." suf(i) = "." Else la(i) = "URoman." suf(i) = "." End If End If If charcode(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha." suf(i) = "." Else la(i) = "URoman." suf(i) = "." End If End If If charcode(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha." suf(i) = "." Else la(i) = "URoman." suf(i) = "." End If End If Else 'If Left(Selection.Range, 1) <> "(" And Right(Selection.Range, 1) = ")" Then 'check ) la(i) = "UAlpha." suf(i) = "." End If End If End If End If If charcode(i) >= 65 And charcode(i) <= 90 Then 'diff>1 check ualpha . If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "(" And right(Selection.Range, 1) = ")" Then 'check ) ElseIf left(Selection.Range, 1) <> "[" And right(Selection.Range, 1) = "]" Then 'check ] ElseIf right(Selection.Range, 1) = "." Then 'check . Else If charcode(i) = 73 Or charcode(i) = 86 Or charcode(i) = 88 Then 'check uroman or ualpha If charcode(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If If charcode(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If If charcode(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha" Else la(i) = "URoman" End If End If Else la(i) = "UAlpha" End If End If End If End If 'LALPHA If charcode(i) >= 97 And charcode(i) <= 122 Then 'diff=1 apply lalpha If diff = 1 Then 'if diff=1 If charcode(i) = 105 Or charcode(i) = 118 Or charcode(i) = 120 Then 'diff its a lroman or lalpha If charcode(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If If charcode(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If If charcode(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If Else If charcode(i) = "111" Then 'alphabet letter o If i = 2 Then If charcode(i + 1) = "112" Then If Selection.font.name <> "Courier New" Then la(i) = "LAlpha" End If Else If Selection.font.name = "Courier New" Then la(i) = "Disc" 'bulltypeArr(i) = "Bull" End If End If End If If i > 2 Then If charcode(i - 1) = "110" And charcode(i + 1) = "112" Then If Selection.font.name <> "Courier New" Then la(i) = "LAlpha" End If Else If Selection.font.name = "Courier New" Then la(i) = "Disc" 'bulltypeArr(i) = "Bull" End If End If End If Else la(i) = "LAlpha" End If End If End If End If 'diff=1 apply lalpha If charcode(i) >= 97 And charcode(i) <= 122 Then 'diff>1 check lalpha ( If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "(" And right(Selection.Range, 1) = ")" Then 'check ) If charcode(i) = 105 Or charcode(i) = 118 Or charcode(i) = 120 Then 'check lroman or lalpha If charcode(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha)" suf(i) = ")" Else la(i) = "LRoman)" suf(i) = ")" End If End If If charcode(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha)" suf(i) = ")" Else la(i) = "LRoman)" suf(i) = ")" End If End If If charcode(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha)" suf(i) = ")" Else la(i) = "LRoman)" suf(i) = ")" End If End If Else 'If Left(Selection.Range, 1) <> "(" And Right(Selection.Range, 1) = ")" Then 'check ) la(i) = "LAlpha)" suf(i) = ")" End If End If End If End If If charcode(i) >= 97 And charcode(i) <= 122 Then 'diff>1 check lalpha [ If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "[" And right(Selection.Range, 1) = "]" Then 'check ] If charcode(i) = 105 Or charcode(i) = 118 Or charcode(i) = 120 Then 'check lroman or lalpha If charcode(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha]" suf(i) = "]" Else la(i) = "LRoman]" suf(i) = "]" End If End If If charcode(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha]" suf(i) = "]" Else la(i) = "LRoman]" suf(i) = "]" End If End If If charcode(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha]" suf(i) = "]" Else la(i) = "LRoman]" suf(i) = "]" End If End If Else 'If Left(Selection.Range, 1) <> "(" And Right(Selection.Range, 1) = ")" Then 'check ) la(i) = "LAlpha]" suf(i) = "]" End If End If End If End If If charcode(i) >= 97 And charcode(i) <= 122 Then 'diff>1 check lalpha . If diff > 1 Then 'if diff>1 If right(Selection.Range, 1) = "." Then 'check . If charcode(i) = 105 Or charcode(i) = 118 Or charcode(i) = 120 Then 'check lroman or lalpha If charcode(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha." suf(i) = "." Else la(i) = "LRoman." suf(i) = "." End If End If If charcode(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha." suf(i) = "." Else la(i) = "LRoman." suf(i) = "." End If End If If charcode(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha." suf(i) = "." Else la(i) = "LRoman." suf(i) = "." End If End If Else 'If Left(Selection.Range, 1) <> "(" And Right(Selection.Range, 1) = ")" Then 'check ) la(i) = "LAlpha." suf(i) = "." End If End If End If End If If charcode(i) >= 97 And charcode(i) <= 122 Then 'diff>1 check lalpha . If diff > 1 Then 'if diff>1 If left(Selection.Range, 1) <> "(" And right(Selection.Range, 1) = ")" Then 'check ) ElseIf left(Selection.Range, 1) <> "[" And right(Selection.Range, 1) = "]" Then 'check ] ElseIf right(Selection.Range, 1) = "." Then 'check . Else If charcode(i) = 105 Or charcode(i) = 118 Or charcode(i) = 120 Then 'check lroman or lalpha If charcode(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If If charcode(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If If charcode(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha" Else la(i) = "LRoman" End If End If Else la(i) = "LAlpha" End If End If End If End If If charcode(i) = 40 Then If charcode1(i) >= 48 And charcode1(i) <= 57 Then la(i) = "Arabic(" pre(i) = "(" suf(i) = ")" End If End If If charcode(i) = 91 Then If charcode1(i) >= 48 And charcode1(i) <= 57 Then la(i) = "Arabic[" pre(i) = "[" suf(i) = "]" End If End If If charcode(i) = 40 Then '( If left(Selection.Range, 1) = "(" Then If charcode1(i) >= 65 And charcode1(i) <= 90 Then If charcode1(i) = 73 Or charcode1(i) = 86 Or charcode1(i) = 88 Then 'diff its a uroman or ualpha If charcode1(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "URoman(" pre(i) = "(" suf(i) = ")" End If End If If charcode1(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "URoman(" pre(i) = "(" suf(i) = ")" End If End If If charcode1(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "URoman(" pre(i) = "(" suf(i) = ")" End If End If Else la(i) = "UAlpha(" pre(i) = "(" suf(i) = ")" End If End If If charcode1(i) >= 97 And charcode1(i) <= 122 Then If charcode1(i) = 105 Or charcode1(i) = 118 Or charcode1(i) = 120 Then 'diff its a uroman or ualpha If charcode1(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "LRoman(" pre(i) = "(" suf(i) = ")" End If End If If charcode1(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "LRoman(" pre(i) = "(" suf(i) = ")" End If End If If charcode1(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha(" pre(i) = "(" suf(i) = ")" Else la(i) = "LRoman(" pre(i) = "(" suf(i) = ")" End If End If Else la(i) = "LAlpha(" pre(i) = "(" suf(i) = ")" End If End If End If End If '( If charcode(i) = 91 Then '[ If left(Selection.Range, 1) = "[" Then If charcode1(i) >= 65 And charcode1(i) <= 90 Then If charcode1(i) = 73 Or charcode1(i) = 86 Or charcode1(i) = 88 Then 'diff its a uroman or ualpha If charcode1(i) = 73 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "URoman[" pre(i) = "[" suf(i) = "]" End If End If If charcode1(i) = 86 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "URoman[" pre(i) = "[" suf(i) = "]" End If End If If charcode1(i) = 88 Then If Selection.Range.style = "Alpha" Then la(i) = "UAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "URoman[" pre(i) = "[" suf(i) = "]" End If End If Else la(i) = "UAlpha[" pre(i) = "[" suf(i) = "]" End If End If If charcode1(i) >= 97 And charcode1(i) <= 122 Then If charcode1(i) = 105 Or charcode1(i) = 118 Or charcode1(i) = 120 Then 'diff its a uroman or ualpha If charcode1(i) = 105 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "LRoman[" pre(i) = "[" suf(i) = "]" End If End If If charcode1(i) = 118 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "LRoman[" pre(i) = "[" suf(i) = "]" End If End If If charcode1(i) = 120 Then If Selection.Range.style = "Alpha" Then la(i) = "LAlpha[" pre(i) = "[" suf(i) = "]" Else la(i) = "LRoman[" pre(i) = "[" suf(i) = "]" End If End If Else la(i) = "LAlpha[" pre(i) = "[" suf(i) = "]" End If End If End If End If If la(i) = "" Then If Selection.text = ChrW(61623) Or Selection.text = "•" Then la(i) = "Round" 'bulltypeArr(i) = "Bull" ElseIf Selection.text = "o" Then la(i) = "Disc" 'bulltypeArr(i) = "Bull" ElseIf Selection.text = ChrW(61607) Then la(i) = "Square" 'bulltypeArr(i) = "Bull" ElseIf Selection.text = ChrW(61485) Or Selection.text = ChrW(8211) Or Selection.text = "–" Then la(i) = "Ndash" 'bulltypeArr(i) = "Bull" ElseIf Selection.text = ChrW(8212) Or Selection.text = "—" Then la(i) = "Mdash" 'bulltypeArr(i) = "Bull" End If End If '******** End If 'find.found End If '<>UL End If 'LA empty Next 'to store the listtype LA 'new other other1 = MaxBullLNo + 1 Dim ostring For i = 2 To MainListcount - 1 If la(i) = "" Then If string1(i) <> "" Then If Len(string1(i)) = 1 Then ostring = string1(i) 'ostring = Selection.Text la(i) = "Other" & other1 'bulltypeArr(i) = "Bull" For j = i + 1 To MainListcount - 1 If ostring = string1(j) Then la(j) = "Other" & other1 'bulltypeArr(j) = "Bull" End If Next other1 = other1 + 1 End If End If End If Next End Sub Sub ContList() Dim parastyle, seltext ReDim la1(5000), ltype2(5000) Dim pararange, removerange As Range Dim varRegex6 As New RegExp ' Declaration for regexp Dim varMatch6 As Match Dim varMatchs6 As MatchCollection varRegex6.Pattern = "\[~C([0-9])~\]" For i = 2 To MainListcount - 1 If la(i) <> "" Then myrange.Paragraphs(i).Range.Select Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:="\[~C([0-9]{1,})~\]", MatchWildcards:=True, Forward:=True pararange.Select If pararange.find.found Then seltext = Selection.text If varRegex6.test(seltext) = True Then Selection.Delete Unit:=wdCharacter, count:=1 End If parastyle = la(i) For j = i + 1 To MainListcount - 1 myrange.Paragraphs(j).Range.Select If la(j) = "" Then Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) pararange.find.ClearFormatting pararange.find.Replacement.ClearFormatting pararange.find.Execute findtext:=seltext, MatchWildcards:=False, Forward:=True If pararange.find.found Then Set removerange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) removerange.find.ClearFormatting removerange.find.Replacement.ClearFormatting removerange.find.Execute findtext:="\[~C([0-9]{1,})~\]", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=True myrange.Paragraphs(j).Range.Select Set removerange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) removerange.Select Selection.InsertAfter "

" Selection.InsertBefore "

" la(j) = parastyle la1(j) = parastyle 'ltype2(j) = ltype(i) 'ltype(j) = "" End If End If Next End If End If Next End Sub Sub ListType() Dim k, ltype1 k = 1 maxim = 0 For i = 2 To MainListcount - 1 If la(i) <> "" Then ltype1 = la(i) For j = i To MainListcount - 1 'If ltype(j) = "" Then If ltype(j) = 0 Then 'and ltype(j) > k If la(j) = ltype1 Then ltype(j) = k If maxim < ltype(j) Then maxim = ltype(j) End If End If Else Exit For End If Next k = k + 1 End If Next For i = 2 To MainListcount - 1 If ltype(i) = 0 Then ltype(i) = "6000" End If Next End Sub Sub paraopen() Dim pararange, rDcm1 As Range Dim varRegex5 As New RegExp ' Declaration for regexp Dim varMatch5 As Match Dim varMatchs5 As MatchCollection varRegex5.Pattern = "UL([0-9])" For i = 2 To MainListcount - 1 myrange.Paragraphs(i).Range.Select Set pararange = ActiveDocument.Range(Selection.Start, Selection.End - 1) pararange.Select If tabletest = 1 And Selection.Information(wdWithInTable) = False Then 'If Selection.Range.ListFormat.ListType <> 0 Then If la(i) <> "" Then 'myrange.Paragraphs(i).Range.Select Set rDcm1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) rDcm1.find.ClearFormatting rDcm1.find.Replacement.ClearFormatting rDcm1.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If rDcm1.find.found Then 'find.found If la(i) <> "UL" Then rDcm1.Select Set selectrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) selectrange.Select diff = Selection.Range.End - Selection.Range.Start Selection.Copy Selection.MoveRight Unit:=wdCharacter, count:=1, Extend:=wdExtend Selection.font.name = "Times New Roman" Selection.TypeText text:="

" pararange.Select 'myrange.Paragraphs(i).Range.Select 'Selection.EndKey Unit:=wdLine Selection.InsertAfter "

" End If End If If la(i) = "UL" Then 'myrange.Paragraphs(i).Range.Select Selection.InsertBefore "

" Selection.InsertAfter "

" End If If varRegex5.test(la(i)) = True Then Selection.InsertBefore "

" Selection.InsertAfter "

" End If Else Selection.InsertBefore "

" Selection.InsertAfter "

" End If If Selection.Range.style = "UL" Then Selection.InsertBefore "" End If End If If tabletest = 0 And Selection.Information(wdWithInTable) = True Then 'If Selection.Range.ListFormat.ListType <> 0 Then If la(i) <> "" Then 'myrange.Paragraphs(i).Range.Select Set rDcm1 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) rDcm1.find.ClearFormatting rDcm1.find.Replacement.ClearFormatting rDcm1.find.Execute findtext:="(*)^t", MatchWildcards:=True, Forward:=True If rDcm1.find.found Then 'find.found rDcm1.Select Set selectrange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) selectrange.Select diff = Selection.Range.End - Selection.Range.Start Selection.Copy Selection.MoveRight Unit:=wdCharacter, count:=1, Extend:=wdExtend Selection.font.name = "Times New Roman" Selection.TypeText text:="

" pararange.Select 'myrange.Paragraphs(i).Range.Select 'Selection.EndKey Unit:=wdLine Selection.InsertAfter "

" End If If la(i) = "UL" Then 'myrange.Paragraphs(i).Range.Select Selection.InsertBefore "

" Selection.InsertAfter "

" End If If varRegex5.test(la(i)) = True Then Selection.InsertBefore "

" Selection.InsertAfter "

" End If Else Selection.InsertBefore "

" Selection.InsertAfter "

" End If If Selection.Range.style = "UL" Then Selection.InsertBefore "" End If End If ' If tabletest = 0 And Selection.Information(wdWithInTable) = True Then ' Selection.InsertBefore "

" ' Selection.InsertAfter "

" ' End If Next 'For i = 2 To MainListcount - 1 ' myrange.Paragraphs(i).Range.Select ' If Selection.Range.Style = "UL" Then ' Selection.InsertBefore "" ' End If 'Next End Sub Sub listopen() Dim varRegex3 As New RegExp ' Declaration for regexp Dim varMatch3 As Match Dim varMatchs3 As MatchCollection varRegex3.Pattern = "Other([0-9])" myrange.Select For max = maxim To 2 Step -1 'traverse max '3 start For i = 3 To MainListcount - 1 'traverse the whole list If ltype(i) <> 0 Then 'except the list para If ltype(i) = max Then 'ltype(lstore) = max If i = 3 Then 'for the third line for bull list If la(i) = la(i - 1) Then 'check second & third line are equal Exit For End If 'check second & third line are equal End If 'for the third line for bull list myrange.Paragraphs(i).Range.Select 'If Selection.Range.ListFormat.ListType <> 0 Then ' not normal para or ul If la(i) <> "" Then 'la<>"" ''Arabic list If la(i) = "Arabic(" Or la(i) = "Arabic[" Or la(i) = "Arabic)" Or la(i) = "Arabic]" Or la(i) = "Arabic." Or la(i) = "Arabic" Then If string1(i) = "1." Or string1(i) = "1)" Or string1(i) = "(1)" Or string1(i) = "1]" Or string1(i) = "[1]" Or string1(i) = "1" Then Selection.InsertBefore "" Else Selection.InsertBefore "" End If End If 'End If 'lowercase alpha If la(i) = "LAlpha(" Or la(i) = "LAlpha[" Or la(i) = "LAlpha)" Or la(i) = "LAlpha]" Or la(i) = "LAlpha." Or la(i) = "LAlpha" Then If string1(i) = "a." Or string1(i) = "a)" Or string1(i) = "(a)" Or string1(i) = "a]" Or string1(i) = "[a]" Or string1(i) = "a" Then Selection.InsertBefore "" Else Selection.InsertBefore "" End If End If 'End If 'uppercase alpha If la(i) = "UAlpha(" Or la(i) = "UAlpha[" Or la(i) = "UAlpha)" Or la(i) = "UAlpha]" Or la(i) = "UAlpha." Or la(i) = "UAlpha" Then If string1(i) = "A." Or string1(i) = "A)" Or string1(i) = "(A)" Or string1(i) = "A]" Or string1(i) = "[A]" Or string1(i) = "A" Then Selection.InsertBefore "" Else Selection.InsertBefore "" End If End If 'End If 'lower roman If la(i) = "LRoman(" Or la(i) = "LRoman[" Or la(i) = "LRoman)" Or la(i) = "LRoman]" Or la(i) = "LRoman." Or la(i) = "LRoman" Then If string1(i) = "i." Or string1(i) = "i)" Or string1(i) = "(i)" Or string1(i) = "i]" Or string1(i) = "[i]" Or string1(i) = "i" Then Selection.InsertBefore "" Else Selection.InsertBefore "" End If End If 'End If 'upper roman If la(i) = "URoman(" Or la(i) = "URoman[" Or la(i) = "URoman)" Or la(i) = "URoman]" Or la(i) = "URoman." Or la(i) = "URoman" Then If string1(i) = "I." Or string1(i) = "I)" Or string1(i) = "(I)" Or string1(i) = "I]" Or string1(i) = "[I]" Or string1(i) = "I" Then Selection.InsertBefore "" Else Selection.InsertBefore "" End If End If 'End If If la(i) = "Round" Or la(i) = "Disc" Or la(i) = "Square" Or la(i) = "Ndash" Or la(i) = "Mdash" Or varRegex3.test(la(i)) = True Then If string1(i) = ChrW(61623) Or string1(i) = "•" Then Selection.InsertBefore text:="" ElseIf string1(i) = "o" Then Selection.InsertBefore text:="" ElseIf string1(i) = ChrW(61607) Then Selection.InsertBefore text:="" ElseIf string1(i) = ChrW(61485) Or string1(i) = ChrW(8211) Or string1(i) = "–" Then Selection.InsertBefore text:="" ElseIf string1(i) = ChrW(8212) Or string1(i) = "—" Then Selection.InsertBefore text:="" Else Selection.InsertBefore text:="" End If End If 'End If 'find.found End If 'la<>"" 'If la(2) <> "UL" Then If Selection.Range.ListFormat.ListType = 0 And Selection.Range.style = "UL" Then 'for UL list Selection.InsertBefore text:="" End If 'End If Exit For End If 'ltype(lstore) = max End If 'except the list para Next 'traverse the whole list Next 'traverse max End Sub Sub listclose() Dim listclose As Range For max = maxim To 1 Step -1 'traverse max For lstore = 2 To MainListcount - 1 'traverse the whole list If ltype(lstore) <> 0 Then 'except the list para If ltype(lstore) = max Then 'ltype(lstore) = max If la(lstore) = "PL" Then Exit For End If myrange.Paragraphs(lstore).Range.Select For lstore1 = lstore To MainListcount - 1 If ltype(lstore1) < max Then If la(lstore1) = "PL" Then ltype(lstore1) = 6000 la(lstore1) = "" End If myrange.Paragraphs(lstore1 - 1).Range.Select Set listclose = ActiveDocument.Range(Selection.Start, Selection.End - 1) listclose.Select Selection.InsertAfter "" Exit For Else If lstore1 = MainListcount - 1 Then myrange.Paragraphs(MainListcount - 1).Range.Select Set listclose = ActiveDocument.Range(Selection.Start, Selection.End - 1) listclose.Select Selection.InsertAfter "
" Exit For End If End If Next Exit For End If 'ltype(lstore) = max End If 'except the list para Next 'traverse the whole list Next 'traverse max End Sub Sub itemclose() Dim pararange As Range myrange.Select For max = maxim To 1 Step -1 'traverse max For lstore = 2 To MainListcount - 1 'traverse the whole list If ltype(lstore) = max Then 'ltype(lstore) = max If la(lstore) = "PL" Then Exit For End If myrange.Paragraphs(lstore).Range.Select For lstore1 = lstore + 1 To MainListcount - 1 If ltype(lstore1) = max Then 'ltype(lstore) = max myrange.Paragraphs(lstore1 - 1).Range.Select Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) pararange.Select Selection.InsertAfter "
" End If Next Exit For End If 'ltype(lstore) = max Next 'traverse the whole list Next 'traverse max ' myrange.Select ' MainListcount = Selection.Range.Paragraphs.count 'For i = 3 To MainListcount - 1 ' If la(i) = la(i - 1) Then ' myrange.Paragraphs(i - 1).Range.Select ' Set pararange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End - 1) ' pararange.Select ' Selection.InsertAfter "
" ' End If 'Next End Sub Sub titleproc() Dim rDcm, newrange, nnewrange, newrange1 As Range 'title processing myrange.Select myrange.Paragraphs(1).Range.Select Set rDcm = ActiveDocument.Range(Selection.Start, Selection.End) rDcm.find.ClearFormatting rDcm.find.Replacement.ClearFormatting rDcm.find.Execute findtext:="\<[!\>]@(*)\>", Forward:=True, MatchWildcards:=True If rDcm.find.found Then rDcm.Select Selection.MoveRight Unit:=wdCharacter, count:=1 Selection.EndKey Unit:=wdLine, Extend:=wdExtend st1 = Selection.Range.Start end1 = Selection.Range.End diff = end1 - st1 If diff <> 1 Then Set newrange = Selection.Range newrange.find.ClearFormatting newrange.find.Replacement.ClearFormatting newrange.find.Execute findtext:="^t", replacewith:="", replace:=wdReplaceAll Set nnewrange = Selection.Range st = Selection.Range.Start e1 = Selection.Range.End nnewrange.find.ClearFormatting nnewrange.find.Replacement.ClearFormatting nnewrange.find.Execute findtext:="", Forward:=True nnewrange.Select temp = Selection.text If temp = "" Then Set newrange1 = ActiveDocument.Range(st, e1 - 1) newrange1.Select Selection.InsertBefore "" Selection.InsertAfter "</subtitle>" Else Set newrange1 = ActiveDocument.Range(st, e1 - 1) newrange1.Select Selection.InsertBefore "<title>" Selection.InsertAfter "" End If End If End If End Sub Sub firstline() Dim varRegex3 As New RegExp ' Declaration for regexp Dim varMatch3 As Match Dim varMatchs3 As MatchCollection varRegex3.Pattern = "Other([0-9])" Dim firstrange, myrange3 As Range myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False If la(2) <> "" Then 'la(2) <> "" myrange.Paragraphs(1).Range.Select Set firstrange = Selection.Range If la(2) = "UL" Then 'UL check firstrange.find.ClearFormatting firstrange.find.Replacement.ClearFormatting firstrange.find.Execute findtext:=" "" End Sub Sub FinalCleanup() Dim myrange3 As Range Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:=" ", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:=" ", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

^t", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="
", replacewith:="
", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="([a-z])\", replacewith:="\1

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=True, MatchCase:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="\\<]{1,})\>" & Chr(13) & Chr(13), replacewith:="^p", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=True myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="\\<]{1,})\>" & Chr(13) & " " & Chr(13), replacewith:="^p", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=True myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False End Sub Sub InitialCleanup() Dim myrange3 As Range 'Set myrange3 = ActiveDocument.Range 'myrange3.Find.ClearFormatting 'myrange3.Find.Replacement.ClearFormatting 'myrange3.Find.Execute findtext:="\[list([!\]]@)\]", replacewith:="", Replace:=wdReplaceAll, Forward:=True, MatchWildcards:=True ' 'Set myrange3 = ActiveDocument.Range 'myrange3.Find.ClearFormatting 'myrange3.Find.Replacement.ClearFormatting 'myrange3.Find.Execute findtext:="[list]", replacewith:="", Replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False ' 'Set myrange3 = ActiveDocument.Range 'myrange3.Find.ClearFormatting 'myrange3.Find.Replacement.ClearFormatting 'myrange3.Find.Execute findtext:="[/list]", replacewith:="", Replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting 'myrange3.Find.Replacement.Style = "Normal" myrange3.find.Execute findtext:=" 0 Then If mul(ml) = "" Then mul(ml) = "ML" check = 1 End If End If End If Next myrange.Select For ml = 2 To MListcount - 1 myrange.Paragraphs(ml).Range.Select If mul(ml) = "ML" Then Selection.InsertBefore "" 'Selection.InsertAfter "

" 'myrange.Paragraphs(ml).Range.Select Set myrange3 = Selection.Range myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="^t", replacewith:="

", replace:=wdReplaceOne, Forward:=True, MatchWildcards:=False End If Next myrange.Select For ml = 2 To MListcount - 1 If mul(ml) = "" Then myrange.Paragraphs(ml).Range.Select Set myrange3 = ActiveDocument.Range(Selection.Start, Selection.End - 1) myrange3.Select If mul(ml - 1) = "ML" Then Selection.InsertBefore "

" Selection.InsertAfter "

" myrange.Paragraphs(ml - 1).Range.Select Set myrange3 = ActiveDocument.Range(Selection.Start, Selection.End - 1) myrange3.Select Selection.InsertAfter "

" Else Selection.InsertBefore "

" Selection.InsertAfter "

" End If End If Next myrange.Select For ml = 2 To MListcount If mul(ml) = "NL" And mul(ml - 1) = "ML" Then myrange.Paragraphs(ml - 1).Range.Select Set myrange3 = ActiveDocument.Range(Selection.Start, Selection.End - 1) myrange3.Select Selection.InsertAfter "

" End If Next myrange.Select For ml = 3 To MListcount 'myrange.Paragraphs(ml).Range.Select If mul(ml) = "ML" Then If mul(ml - 1) = "NL" Then myrange.Paragraphs(ml - 1).Range.Select Selection.InsertAfter "
" Else myrange.Paragraphs(ml - 1).Range.Select Selection.InsertAfter "

" End If End If If ml = MListcount And check = 1 Then myrange.Paragraphs(MListcount - 1).Range.Select Selection.InsertAfter "

" check = 0 End If Next myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="^p

", replacewith:="

^p", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="^p", replacewith:="^p", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="

", replacewith:="

", replace:=wdReplaceAll, Forward:=True, MatchWildcards:=False myrange.Select Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="", replacewith:="", replace:=wdReplaceOne, Forward:=True, MatchWildcards:=False Set myrange3 = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End) myrange3.find.ClearFormatting myrange3.find.Replacement.ClearFormatting myrange3.find.Execute findtext:="