rename a macro

  1. click on the macros icon in Developer:

2. select the macro you want to rename and click Edit. This will bring up the code for that macro.

3. change the name to the new one. Make sure there are no spaces and make sure you leave the () at the end of the name. I’m going to change BigAl to LittleAl:

4. close the VBA editor with the cross at the top right. The macro is now renamed.

record a macro

Sometimes you want to do a repetitive task in Word and you think, ‘It’s a computer – it can see what I want to do, why can’t it just carry on and finish the job?’ In this situation make a macro to do the job. All you have to do is carry out the task once while recording your keystrokes then it takes just four clicks to carry out that same task. To record a macro:

  1. make sure that you have Developer on your toolbar as described here.
  2. click on Record Macro

3. give your macro a name, without any spaces. It is traditional to use capital letters at the start of a word and join them together.

4. Press ok. From now on every keystroke you make is recorded and turned into lines of VBA code. It will only record keystrokes though, not mouse actions.

5. When you have finished press Stop Recording. You now have some lines of code which will do the job for you.

6. To access your macro in future, go to the macro icon. Mine is on the Quick Access Toolbar as I use it a lot, but it’s also in Developer:

7. Clicking on it will bring up a list of your macros in alphabetical order. Click Run to run it or Step Into to see what your code looks like.

8. If you use your macro a lot, add it to the Quick Access Toolbar as described here. From then on it is always visible, whatever you are doing to any document, and it takes just one click to run it.

open another document from the Quick Access Toolbar

I have one particular document which I use very often when I am writing resources. Because I frequently need to open it from the document I am currently working on I have an icon for it on the Quick Access toolbar:

The document has all my organic displayed formulas on it. When I need a displayed formula, I could get it from the internet but I like to have all my displayed formulae in House style and be able to manipulate them easily. When I open the document I have my hyperlinked menu:

Clicking on any title takes me to that page and I have an assortment of part-molecules:

I copy the pieces I need then assemble them to make the molecule I want, then save it for when I next need it.

So with two clicks in whatever document I am working in I can get to the amines page of my drawing document. The code to open a particular document from a different one is:

Sub OpenDocument()

Documents.Open FileName:="N:\my doc. chemistry\drawing.docx", ReadOnly:=False
End Sub

remove double spaces

My colleague Ada Nurel is always very frustrated by numpties who put double spaces into their documents, and especially ones who spread out their chemical equations with lots of spaces. She notes that when she does a ‘replace all’ and replaces a double space with a single it will still leave double spaces since three spaces will reduce to two. She therefore has to do the ‘replace all’ several times.

The following macro goes through a document and gets rid of multiple spaces:

Sub RemoveDoubleSpaces()
 Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "  "
        .Replacement.Text = " "
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.Execute Replace:=wdReplaceAll

End Sub

sort out font for Cl and Al

In Arial the font for the 9th letter and the 12th letter of the alphabet are the same, which means that the symbol for chlorine is the same as for carbon monoidide. OCR exam papers solve this problem by writing the 12th letter of the alphabet in Book Antiqua Italic when it is in the formula for chlorine or aluminium. The following macro does that – it won’t change the letter in a word containing that letter, but will when it is in a formula.

'italic and book antiqua l for Cl and Al
Selection.WholeStory
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "([CA])(l)([!a-z])"
        .Replacement.Text = "\1++l++\3"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.WholeStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    Selection.Find.Replacement.Font.Italic = True
    With Selection.Find
        .Text = "++l++"
        .Replacement.Text = "l"
        .Replacement.Font.Name = "Book Antiqua"
        .Replacement.Font.Size = 11
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchAllWordForms = False
        .MatchSoundsLike = False
        .MatchWildcards = True
    End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub


landscape format

My Russian colleague Edna Ural produces a lot of resources in landscape format since they are intended for the student to look at on their screen rather than to be printed out. This macro formats a landscape document in House style:

Selection.WholeStory
    If Selection.PageSetup.Orientation = wdOrientPortrait Then
        Selection.PageSetup.Orientation = wdOrientLandscape
    Else
        Selection.PageSetup.Orientation = wdOrientPortrait
    End If
    Selection.WholeStory
    With ActiveDocument.Styles(wdStyleNormal).Font
        If .NameFarEast = .NameAscii Then
            .NameAscii = ""
        End If
        .NameFarEast = ""
    End With
    With ActiveDocument.PageSetup
        .LineNumbering.Active = False
        .Orientation = wdOrientLandscape
        .TopMargin = CentimetersToPoints(1.2)
        .BottomMargin = CentimetersToPoints(1.2)
        .LeftMargin = CentimetersToPoints(2.54)
        .RightMargin = CentimetersToPoints(2.54)
        .Gutter = CentimetersToPoints(0)
        .HeaderDistance = CentimetersToPoints(1.25)
        .FooterDistance = CentimetersToPoints(1.25)
        .PageWidth = CentimetersToPoints(29.7)
        .PageHeight = CentimetersToPoints(21)
        .FirstPageTray = wdPrinterDefaultBin
        .OtherPagesTray = wdPrinterDefaultBin
        .SectionStart = wdSectionNewPage
        .OddAndEvenPagesHeaderFooter = False
        .DifferentFirstPageHeaderFooter = False
        .VerticalAlignment = wdAlignVerticalTop
        .SuppressEndnotes = False
        .MirrorMargins = False
        .TwoPagesOnOne = False
        .BookFoldPrinting = False
        .BookFoldRevPrinting = False
        .BookFoldPrintingSheets = 1
        .GutterPos = wdGutterPosLeft
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.25)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.5)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.75)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(1)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.75)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.75)
    End With
    Selection.PageSetup.LeftMargin = CentimetersToPoints(2.5)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(2.25)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(2)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(1.75)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(1.5)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(1.25)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(1)
    Selection.PageSetup.LeftMargin = CentimetersToPoints(1)
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.5)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0.25)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0)
    End With
    With Selection.ParagraphFormat
        .SpaceBeforeAuto = False
        .SpaceAfterAuto = False
        .FirstLineIndent = CentimetersToPoints(0)
    End With
    Selection.PageSetup.RightMargin = CentimetersToPoints(2.7)
    Selection.PageSetup.RightMargin = CentimetersToPoints(2.45)
    Selection.PageSetup.RightMargin = CentimetersToPoints(2.2)
    Selection.PageSetup.RightMargin = CentimetersToPoints(1.95)
    Selection.PageSetup.RightMargin = CentimetersToPoints(1.7)
    Selection.PageSetup.RightMargin = CentimetersToPoints(1.7)
    Selection.WholeStory
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(1), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(2), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(3), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(4), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(5), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(6), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(7), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(8), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(9), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(10), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(11), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(12), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(13), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(14), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(15), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(16), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(17), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(18), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(19), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(20), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(21), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(22), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(23), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(24), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(25), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(26), _
        Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
    Selection.WholeStory
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 11
    Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
    With Selection.ParagraphFormat
        .LeftIndent = CentimetersToPoints(0)
        .RightIndent = CentimetersToPoints(0)
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 0
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceSingle
        .Alignment = wdAlignParagraphJustify
        .WidowControl = True
        .KeepWithNext = False
        .KeepTogether = False
        .PageBreakBefore = False
        .NoLineNumber = False
        .Hyphenation = True
        .FirstLineIndent = CentimetersToPoints(0)
        .OutlineLevel = wdOutlineLevelBodyText
        .CharacterUnitLeftIndent = 0
        .CharacterUnitRightIndent = 0
        .CharacterUnitFirstLineIndent = 0
        .LineUnitBefore = 0
        .LineUnitAfter = 0
        .MirrorIndents = False
        .TextboxTightWrap = wdTightNone
        .CollapsedByDefault = False
    End With
End Sub

impressive resources using bookmarks and hyperlinks

I use bookmarks and hyperlinks a lot when making resources. I have therefore added them to my Quick Access Toolbar so that they are available with one click:

Bookmarks and hyperlinks in a Word document are still active when the document is saved as a pdf. A Word document hundreds of pages long takes up little memory space when saved as a pdf, can run on any device and the students can’t mess it up. An index at the start of the document enables the user to jump straight to the part of the pdf that they need. They can return to where they were using Alt <arrow left> or using a hyperlink on the page they have jumped to.

This is part of the whole A level syllabus on one landscape page:

Clicking on 5.2.2 Enthalpy and entropy takes the user to here:

Clicking on 5.2.2 (e) explanation, and related calculations, takes the user to:

At the bottom of that page is a back button to go back to the syllabus. The whole document, with notes on every area of the syllabus, is 360 pages but is easily navigated by a student with an ipad on their lap on the plane to Mauritius for Christmas.

If you want to buy this resource it is here for £4.

The document below is part of digital flashcards for a Year 7 student revising for the summer exams:

Each word is hyperlinked to a different sheet with the answer on. So clicking on atom takes the user to a different page with this extra information in:

so the answer magically appears. Again the document is hundreds of pages long but the Year 7 student in the back of the car on the way to Cornwall can test themselves on their Chemistry by clicking on a document which needs no internet connection and can’t be messed up by the student.

add an equilibrium sign

In AutoCorrect I have added eqmz in the left-hand box and ⇌ in the right-hand box. This means that every time I need an equilibrium symbol I just type eqmz.

See here for how to add to the AutoCorrect table.

See here for how to find the Unicode symbol for the equilibrium arrow on the keyboard.

To find the Unicode symbol of any character use my macro here.

add a macro to the Quick Access Toolbar

I use my formatting formulae macro a lot so I have a smiley face icon for it on the Quick Access Toolbar:

To assign a macro to the Quick Access Toolbar do the following:

  1. Right-click on the Toolbar
  2. Select Customise the Ribbon
  3. Select Quick Access Toolbar  

4. In Choose commands from pick Macros

5. Select your macro

6. Click the Add button. The command now appears at the right side of the dialog box. You might have to click on a random group on the right-hand side to make it appear as a subset of it.

7. Click the OK button. The command now appears on the Quick Access toolbar.

8. To replace the default macro icon with a different button for your macro, click Modify. Under Symbol, select an icon for your macro. Choose one that isn’t already in use.

9. Click OK twice. The new button appears on the Quick Access Toolbar, where you can click it to run the macro.

insert a formatted table

I use a lot of tables when I am making resources here at Southampton and I always like them in this format:

  1. column headings bold and justified
  2. left-hand column aligned left
  3. all other columns justified

I used to spend a lot of time formatting each table that I drew but now I have an icon on my Quick Access Toolbar. When I press this button I get a message asking me how many columns I want – 1, 2, 3 or 4. When I have selected, it draws me a table formatted as above then asks me if I want bold lines for the outside border. So with two clicks and a number inserted I get a table set up to suit me, with default five lines. The code is here:

Sub TableChoice()

'make popup box
10 Dim Message, Title, MyValue
Message = "enter a value between 1 and 4"
Title = "how many columns do you want?"

'deal with inputs
MyValue = InputBox(Message, Title, MyValue)
If MyValue = 1 Then GoTo 100
If MyValue = 2 Then GoTo 2000
If MyValue = 3 Then GoTo 3000
If MyValue = 4 Then GoTo 4000
If MyValue = "" Then GoTo 5000

'deal with wrong inputs
BeepMsg "you were told to choose 1 to 4 columns, numpty"
GoTo 10

'one column
'draw table
100    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
        1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
        wdAutoFitFixed
   
 'find table number
 Dim J As Integer
    Dim iTableNum As Integer
    Dim oTbl As Table
    Selection.Bookmarks.Add ("TempBM")
    For J = 1 To ActiveDocument.Tables.Count
        Set oTbl = ActiveDocument.Tables(J)
        oTbl.Select
        If Selection.Bookmarks.Exists("TempBM") Then
           iTableNum = J
           Exit For
       End If
   Next J
    ActiveDocument.Bookmarks("TempBM").Select
    ActiveDocument.Bookmarks("TempBM").Delete
 If ActiveDocument.Tables.Count >= 1 Then
 'Selection.TypeText Text:="here"
'ActiveDocument.Tables(iTableNum).Cell(1, 1).Delete
End If

'give table number and ask for bold
Select Case MsgBox("bold lines around table " & iTableNum, vbYesNo)
Case vbNo
            GoTo 900
      Case vbYes
            GoTo 950
    End Select
   
'justify columns and make heading bold if not bold
900 Selection.Font.Bold = wdToggle                      'line1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=4
 GoTo 5000
 
 'justify columns and make heading bold if bold selected
950 Selection.Font.Bold = wdToggle                      'line1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=4
    
 'lines bold
    With Selection.Borders(wdBorderTop)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
        .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
        .LineWidth = wdLineWidth150pt
    End With
Selection.MoveUp Unit:=wdLine, Count:=4
 GoTo 5000

'two columns
'draw table
2000    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
        2, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
        wdAutoFitFixed
   
 'find table number
 Dim K As Integer
    Dim iTableNum2 As Integer
    Dim oTbl2 As Table
    Selection.Bookmarks.Add ("TempBM")
    For K = 1 To ActiveDocument.Tables.Count
        Set oTbl2 = ActiveDocument.Tables(K)
        oTbl2.Select
        If Selection.Bookmarks.Exists("TempBM") Then
           iTableNum2 = K
           Exit For
       End If
   Next K
    ActiveDocument.Bookmarks("TempBM").Select
    ActiveDocument.Bookmarks("TempBM").Delete
 If ActiveDocument.Tables.Count >= 1 Then
End If
   
   'give table number and ask for bold
Select Case MsgBox("bold lines around table " & iTableNum2, vbYesNo)
Case vbNo
            GoTo 2900
      Case vbYes
            GoTo 2950
    End Select
   
 'justify columns and make headings bold
2900   Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 right
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left  
GoTo 5000
    
'justify columns and make headings bold if bold selected
2950   Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 right
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left

 'lines bold
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
     Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
 GoTo 5000

'three columns
'draw table
3000    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
        3, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
        wdAutoFitFixed
   
 'find table number
 Dim L As Integer
    Dim iTableNum3 As Integer
    Dim oTbl3 As Table
    Selection.Bookmarks.Add ("TempBM")
    For L = 1 To ActiveDocument.Tables.Count
        Set oTbl3 = ActiveDocument.Tables(L)
        oTbl3.Select
        If Selection.Bookmarks.Exists("TempBM") Then
           iTableNum3 = L
           Exit For
       End If
   Next L
    ActiveDocument.Bookmarks("TempBM").Select
    ActiveDocument.Bookmarks("TempBM").Delete
 If ActiveDocument.Tables.Count >= 1 Then
End If
   
  'give table number and ask for bold
Select Case MsgBox("bold lines around table " & iTableNum3, vbYesNo)

Case vbNo
            GoTo 3900
      Case vbYes
            GoTo 3950
    End Select
   
 'justify columns and make headings bold
3900    Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 middle
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left
    Selection.MoveRight Unit:=wdCharacter, Count:=2     'line1 right
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=4
    Selection.MoveLeft Unit:=wdCharacter, Count:=2
   GoTo 5000

'justify columns and make headings bold if bold selected
3950    Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 middle
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left
    Selection.MoveRight Unit:=wdCharacter, Count:=2     'line1 right
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=4
    Selection.MoveLeft Unit:=wdCharacter, Count:=2
    
 'lines bold
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
     Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
GoTo 5000

'four columns
'draw table
4000    ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
        4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
        wdAutoFitFixed
   
 'find table number
 Dim M As Integer
    Dim iTableNum4 As Integer
    Dim oTbl4 As Table
    Selection.Bookmarks.Add ("TempBM")
    For M = 1 To ActiveDocument.Tables.Count
        Set oTbl4 = ActiveDocument.Tables(M)
        oTbl4.Select
        If Selection.Bookmarks.Exists("TempBM") Then
           iTableNum4 = M
           Exit For
       End If
   Next M
    ActiveDocument.Bookmarks("TempBM").Select
    ActiveDocument.Bookmarks("TempBM").Delete
 If ActiveDocument.Tables.Count >= 1 Then
End If
   
  'give table number and ask for bold
Select Case MsgBox("bold lines around table " & iTableNum4, vbYesNo)
Case vbNo
            GoTo 4900
      Case vbYes
            GoTo 4950
    End Select
   
 'justify columns and make headings bold
4900    Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 middle1
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left
    Selection.MoveRight Unit:=wdCharacter, Count:=2     'line1 middle2
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.Font.Bold = wdToggle
    Selection.MoveLeft Unit:=wdCharacter, Count:=3
   GoTo 5000

'justify columns and make headings bold if bold selected
'justify columns and make headings bold
4950    Selection.Font.Bold = wdToggle                      'line1 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line1 middle1
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle1
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveLeft Unit:=wdCharacter, Count:=1     'line5 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 left
    Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 left
    Selection.MoveRight Unit:=wdCharacter, Count:=2     'line1 middle2
    Selection.Font.Bold = wdToggle
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line2 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line3 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line4 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveDown Unit:=wdLine, Count:=1           'line5 middle2
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveRight Unit:=wdCharacter, Count:=1     'line5 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line4 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line3 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line2 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.MoveUp Unit:=wdLine, Count:=1           'line1 right
    Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
    Selection.Font.Bold = wdToggle
    Selection.MoveLeft Unit:=wdCharacter, Count:=3
    
    
 'lines bold
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveDown Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderLeft)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderRight)
        .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
     Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveUp Unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderRight)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    End With
    With Selection.Borders(wdBorderTop)
     .LineWidth = wdLineWidth150pt
    End With
    With Selection.Borders(wdBorderBottom)
     .LineWidth = wdLineWidth150pt
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1

5000
    
    
End Sub