Attribute VB_Name = "Itracks_4_module"
Option Explicit
Sub FormatTopicQuestion()
' selectTopicQuestion Macro
' Macro created 7/28/2008 by P Belisle
' This is to determine which macro to use depending on the value of the level in cell 1
' We should be in cell 1 when this kicks in
' lev is outline level and mylistvalue is the value of the list
Dim lev As Integer
Dim MyListValue As Integer
Dim MyListString As String
'find out what level the cell is
lev = Selection.Range.ListFormat.ListLevelNumber
MyListValue = Selection.Range.ListFormat.ListValue
MyListString = CStr(MyListValue)
If lev = 1 Then
' Highlight the row
Selection.SelectRow
With Selection.Cells
With .Shading
.Texture = wdTexture5Percent
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
'make the row bigger like a topic should be
Selection.Font.Size = 20
'Selection.Range.ListFormat.ListLevelNumber = 1
'now write a no in cell 5
Selection.MoveRight unit:=wdCell, Count:=5
Selection.TypeText Text:="No"
' Then move the cursor back to the second cell
Selection.MoveLeft unit:=wdCell, Count:=3
Else
' Highlight the row
Selection.SelectRow
With Selection.Cells
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorWhite
End With
End With
With Options
.DefaultBorderLineStyle = wdLineStyleSingle
.DefaultBorderLineWidth = wdLineWidth050pt
.DefaultBorderColor = wdColorAutomatic
End With
'make the row the same size as the other questions
Selection.Font.Size = 11
Selection.Cells(5).Shading.BackgroundPatternColorIndex = wdColorWhite
'find out what level the cell is
'now write a yes in cell 5
Selection.MoveRight unit:=wdCell, Count:=5
Selection.TypeText Text:="Yes"
Selection.MoveLeft unit:=wdCell, Count:=3
End If
End Sub
Public Sub convertTableToTab()
Dim oTable As Word.Table
'need to convert the list to alpha
' want to do it just selecting table 1
ActiveDocument.Tables(1).Select
'First convert column1
Selection.SetRange _
Start:=Selection.Cells(1).Range.Start, _
End:=Selection.End
Selection.Range.ListFormat.ConvertNumbersToText
' \\ Get a handle to the bookmarked table
Set oTable = ActiveDocument.Tables(1)
oTable.ConvertToText Separator:=wdSeparateByTabs
' \\ Clean up
Set oTable = Nothing
ActiveDocument.SaveAs FileName:="c:\itracks\olfgupload.txt", fileformat:=wdFormatEncodedText, Encoding:=msoEncodingUTF8
End Sub
Sub Format_Html()
'
' Convert bold, italic, and underline to html tags Macro
' Macro originally designed by Lucas Brachish Celebrity Cola.blogspot.com
' Adapted by P. Belisle 2008
' With code from Word MVP Bill Coan (http://word.mvps.org/)
'
' Replace bold
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
Selection.Find.ClearFormatting
Selection.Find.Font.Bold = True
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Bold = False
With Selection.Find
.Text = "<*>"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace italic
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
Selection.Find.ClearFormatting
Selection.Find.Font.Italic = True
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Italic = False
With Selection.Find
.Text = "<*>"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Replace underline
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
Selection.Find.ClearFormatting
Selection.Find.Font.Underline = wdUnderlineSingle
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Underline = wdUnderlineNone
With Selection.Find
.Text = "<*>"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindStop
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "<b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
' Get rid of all of the extraneous symbols caused by the replacing
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "<b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "<i>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "i>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "<b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "b>"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.SelectColumn
If Selection.Information(wdWithInTable) Then
Selection.Columns(1).Select
Selection.SetRange _
Start:=Selection.Cells(2).Range.Start, _
End:=Selection.End
End If
With Selection.Find
.Text = "