title: MSACCESS VBA: Add borders to Excel Sheet
body: <p>The below does not work. How do I add borders? Thanks!</p>
  
  <pre><code>            Set objApp = CreateObject("Excel.Application")
              objApp.Visible = True
              Set wb = objApp.Workbooks.Open("aFile.xls", True, False)
              objApp.Cells.Select
              objApp.Selection.Borders(xlDiagonalDown).LineStyle = xlNone
              objApp.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
              With objApp.Selection.Borders(xlEdgeLeft)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
              With objApp.Selection.Borders(xlEdgeTop)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
              With objApp.Selection.Borders(xlEdgeBottom)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
              With objApp.Selection.Borders(xlEdgeRight)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
              With objApp.Selection.Borders(xlInsideVertical)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
              With objApp.Selection.Borders(xlInsideHorizontal)
                  .LineStyle = xlContinuous
                  .ColorIndex = 0
                  .TintAndShade = 0
                  .Weight = xlThin
              End With
  
              Set objApp = Nothing
  </code></pre>