draw an electrode potential table

If you are producing resources for the electrochemistry topic you often need to draw this table:

It looks like a two-column table but if the left-hand column is actually three columns you can keep the equilibrium signs underneath each other in their own narrow column which has no left or right border.

Once you have made this table you can save it in Building Blocks using the method here. It can then be called up quickly and easily, as can any table.

The macro below draws this four-column table with column headings and equilibrium signs already populated. Column 1 is aligned right, column 2 is justified, column 3 is aligned left and column 4 is justified, as are the column headings. When you add the equations they are already formatted as above.

Selection.Delete unit:=wdCharacter, Count:=1

'make table
        ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=5, NumColumns:= _
        4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
        wdAutoFitFixed
    With Selection.Tables(1)
        If .Style <> "Table Grid" Then
            .Style = "Table Grid"
        End If
        .ApplyStyleHeadingRows = True
        .ApplyStyleLastRow = False
        .ApplyStyleFirstColumn = True
        .ApplyStyleLastColumn = False
        .ApplyStyleRowBands = True
        .ApplyStyleColumnBands = False
    End With
   
   'set column widths
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=106.8, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=99.7, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=92.6, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=85.5, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=78.45, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=71.35, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=64.25, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=57.15, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=50.1, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=43, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=35.9, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=28.8, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=21.75, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=21.75, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=107, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=99.9, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=92.8, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=85.75, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=78.65, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=71.55, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=64.45, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=57.4, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=50.3, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=43.2, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=36.1, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=43.2, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(4).SetWidth ColumnWidth:=43.2, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=21.75, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=28.8, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=35.9, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=43, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=43, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=112.7, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=120.25, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=127.35, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=134.45, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=127.35, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=134.45, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(1).SetWidth ColumnWidth:=134.45, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=43, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=35.4, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=28.35, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=21.25, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(2).SetWidth ColumnWidth:=21.25, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(3).SetWidth ColumnWidth:=106.3, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(3).SetWidth ColumnWidth:=99.2, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(3).SetWidth ColumnWidth:=92.15, RulerStyle:= _
        wdAdjustNone
    Selection.Tables(1).Columns(3).SetWidth ColumnWidth:=92.15, RulerStyle:= _
        wdAdjustNone
    Selection.MoveRight unit:=wdCharacter, Count:=3
    
   'type E standard heading
    With Selection.Font
    .Bold = True
    End With
    Selection.TypeText Text:="E"
    Selection.Font.Superscript = wdToggle
    With Selection.Font
        .Name = "Arial"
        .Size = 11
        .Position = 2
        .Bold = True
    End With
    Selection.Font.Size = 8
    Selection.InsertSymbol Font:="Arial", CharacterNumber:=1012, Unicode:=True
    Selection.Font.Size = 11
    Selection.Font.Superscript = wdToggle
    With Selection.Font
        .Name = "Arial"
        .Size = 11
        .Bold = True
        .Position = 0
    End With
    Selection.TypeText Text:=" / V"
    Selection.Font.Bold = wdToggle
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter

 
 'type equilibrium signs
 Selection.MoveDown unit:=wdLine, Count:=1
 Selection.MoveLeft unit:=wdCharacter, Count:=2
 Selection.TypeText Text:=ChrW(8652)
 Selection.MoveDown unit:=wdLine, Count:=1
 Selection.TypeText Text:=ChrW(8652)
 Selection.MoveDown unit:=wdLine, Count:=1
 Selection.TypeText Text:=ChrW(8652)
 Selection.MoveDown unit:=wdLine, Count:=1
 Selection.TypeText Text:=ChrW(8652)
 Selection.MoveRight unit:=wdCharacter, Count:=2
 Selection.MoveUp unit:=wdLine, Count:=3
 
 'justifying columns first line
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=2
 Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
 
 Selection.MoveRight unit:=wdCharacter, Count:=4
 Selection.MoveDown unit:=wdLine, Count:=1
 
'justifying columns second line
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=2
 Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
 
 Selection.MoveRight unit:=wdCharacter, Count:=4
 Selection.MoveDown unit:=wdLine, Count:=1


'justifying columns third line
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=2
 Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
 
 Selection.MoveRight unit:=wdCharacter, Count:=4
 Selection.MoveDown unit:=wdLine, Count:=1

'justifying columns fourth line
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
 
 Selection.MoveLeft unit:=wdCharacter, Count:=1
 Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
 Selection.MoveLeft unit:=wdCharacter, Count:=2
 Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
 
 Selection.MoveRight unit:=wdCharacter, Count:=4
 Selection.MoveUp unit:=wdLine, Count:=4

'middle column no left and right borders
Selection.MoveDown unit:=wdLine, Count:=1
Selection.MoveLeft unit:=wdCharacter, Count:=2

'remove border at top
Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
    
'remove border one down
    Selection.MoveDown unit:=wdLine, Count:=1
    Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
    
 'remove border one down
    Selection.MoveDown unit:=wdLine, Count:=1
    Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
    
 'remove border one down
    Selection.MoveDown unit:=wdLine, Count:=1
    Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
      
  'add border at bottom
    With Selection.Borders(wdBorderBottom)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    
 'add border at one up from bottom
    Selection.MoveUp unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderBottom)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    
  'add border one up
    Selection.MoveUp unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderBottom)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    
'add border one up
    Selection.MoveUp unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderBottom)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    
'add border one up
    Selection.MoveUp unit:=wdLine, Count:=1
    With Selection.Borders(wdBorderBottom)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
    
'add border one up
    With Selection.Borders(wdBorderTop)
        .LineStyle = Options.DefaultBorderLineStyle
        .LineWidth = Options.DefaultBorderLineWidth
        .Color = Options.DefaultBorderColor
    End With
             
'merge two cells
 Dim mrgrng As Range
With Selection.Tables(1)
    
Set mrgrng = .Cell(1, 1).Range
mrgrng.End = .Cell(1, 3).Range.End
mrgrng.Cells.Merge
End With

'type E standard heading and align
Selection.Font.Bold = wdToggle
Selection.Font.Name = "Arial"
Selection.Font.Size = 11
Selection.TypeText Text:="Redox system"
Selection.Font.Bold = wdToggle
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
 
End Sub


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: