Sub TextXL()
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet
Set wkb = GetObject(CurrentProject.Path & "\TestOutputFile.xls")
wkb.Windows(1).Visible = True
Set wks = wkb.Worksheets(1)
With wks.Cells
.VerticalAlignment = xlBottom
.WrapText = False
.Borders.LineStyle = xlNone
.EntireColumn.AutoFit
.AutoFilter
.Columns("D:E").Group
With .Columns("I:K")
.NumberFormat = "m/d/yy;@"
.HorizontalAlignment = xlCenter
End With
.Columns("L:M").HorizontalAlignment = xlCenter
.Columns("N:N").NumberFormat = "$#,##0.00"
.Columns("O:AR").NumberFormat = "_(* #,##0_);_(* (#,##0);_(* ""-""??_);_(@_)"
.Columns("T:Z").Group
.Columns("AB:AI").Group
End With
wks.Range("F2").Select
wkb.Windows(1).FreezePanes = True
With wks.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
.LeftHeader = ""
.CenterHeader = "&A"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = 0.25 * 72
.RightMargin = 0.25 * 72
.TopMargin = 1 * 72
.BottomMargin = 0.75 * 72
.HeaderMargin = 0.5 * 72
.FooterMargin = 0.5 * 72
End With
wkb.Save
wkb.Close
End Sub
|