Access.2007.VBA.Bibl..

(John Hannent) #1
.Range(“D:D”).ColumnWidth = 20
.Range(“E:E”).ColumnWidth = 15
.Range(“F:F”).ColumnWidth = 20

Insert blank rows at top of worksheet:

.Range(“1:1”).Insert Shift:=xlDown
.Range(“1:1”).Insert Shift:=xlDown
.Range(“1:1”).Insert Shift:=xlDown
.Range(“1:1”).Insert Shift:=xlDown

Format the column headings row:

With .Range(“5:5”)
.Font.Size = 10
.Font.Bold = True
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Interior.ColorIndex = 15
.Interior.Pattern = xlSolid
.Interior.PatternColorIndex = xlAutomatic
.RowHeight = 15
.VerticalAlignment = xlBottom
.HorizontalAlignment = xlCenter
.WrapText = True
End With

Insert and format title text:

.Range(“A1:F1”).HorizontalAlignment = xlCenter
.Range(“A1:F1”).VerticalAlignment = xlBottom
.Range(“A1:F1”).WrapText = False
.Range(“A1:F1”).Orientation = 0
.Range(“A1:F1”).ShrinkToFit = False
.Range(“A1:F1”).MergeCells = True
.Range(“A1:F1”).Borders(xlDiagonalDown).LineStyle = _
xlNone
.Range(“A1:F1”).Borders(xlDiagonalUp).LineStyle = _
xlNone
.Range(“A1:F1”).Borders(xlEdgeLeft).LineStyle = xlNone
.Range(“A1:F1”).Borders(xlEdgeTop).LineStyle = xlNone
.Range(“A1:F1”).Borders(xlEdgeBottom).LineStyle = _
xlNone
.Range(“A1:F1”).Borders(xlEdgeRight).LineStyle = _
xlNone
.Range(“A1:F1”).Borders(xlInsideVertical).LineStyle = _
xlNone
.Range(“A2:F2”).HorizontalAlignment = xlCenter

Part II Writing VBA Code to Exchange Data between Office Components

Free download pdf