I'm trying to format an export to Excel to orientation, paper size, Print Area, etc. but Access doen't like some of my syntax. Any ideas.
xlApp.Workbooks.Open outFile
With xlApp
xlApp.DisplayAlerts = False
.Application.Visible = True
.UserControl = True
.ScreenUpdating = True
.range("A:A, X:Y").ColumnWidth = 5
.range("B:E,H:I,N,T:U").ColumnWidth = 10
.range("F:G,J:M,Q:S").ColumnWidth = 30
.rows("1:1").Font.Bold = True
.range("A:U").WrapText = True
.range("A:U").EntireRow.AutoFit
.HorizontalAlignment = True
.VerticalAlignment = True
''''''''''Set Print Area'''''''''''''''''''''''''''''''''''''''''
' xlApp.ActiveSheet.PageSetup.PrintArea = "$A$1:$U$" & (Rows.Count, 15).End(xlUp).Row
' With xlApp.PageSetup
' .CenterHeader = "&""Arial,Bold""&20&Tab&k "
' .LeftFooter = "&D"
' .RightFooter = "&[Page]& ' Of ' &[Pages]"
' .PrintHeadings = False
' .PrintGridlines = True
' .CenterHorizontally = -4108
' .Orientation = xlLandscape
' .FitToPagesWide = 1
' .FitToPagesTall = False
' .Draft = False
' End With
' With xlWS
' .UsedRange.HorizontalAlignment = xlCenter
' .UsedRange.VerticalAlignment = xlCenter
' .UsedRange.Rows.RowHeight = 15.25
' End With
' ***************************************************************************
' Select to make sure the sheet has focus
' xlWS.Range("A1").Select
.ActiveWorkbook.SaveAs FileName:=outFile
xlApp.DisplayAlerts = True
.Quit
End With
xlApp.Workbooks.Open outFile
With xlApp
xlApp.DisplayAlerts = False
.Application.Visible = True
.UserControl = True
.ScreenUpdating = True
.range("A:A, X:Y").ColumnWidth = 5
.range("B:E,H:I,N,T:U").ColumnWidth = 10
.range("F:G,J:M,Q:S").ColumnWidth = 30
.rows("1:1").Font.Bold = True
.range("A:U").WrapText = True
.range("A:U").EntireRow.AutoFit
.HorizontalAlignment = True
.VerticalAlignment = True
''''''''''Set Print Area'''''''''''''''''''''''''''''''''''''''''
' xlApp.ActiveSheet.PageSetup.PrintArea = "$A$1:$U$" & (Rows.Count, 15).End(xlUp).Row
' With xlApp.PageSetup
' .CenterHeader = "&""Arial,Bold""&20&Tab&k "
' .LeftFooter = "&D"
' .RightFooter = "&[Page]& ' Of ' &[Pages]"
' .PrintHeadings = False
' .PrintGridlines = True
' .CenterHorizontally = -4108
' .Orientation = xlLandscape
' .FitToPagesWide = 1
' .FitToPagesTall = False
' .Draft = False
' End With
' With xlWS
' .UsedRange.HorizontalAlignment = xlCenter
' .UsedRange.VerticalAlignment = xlCenter
' .UsedRange.Rows.RowHeight = 15.25
' End With
' ***************************************************************************
' Select to make sure the sheet has focus
' xlWS.Range("A1").Select
.ActiveWorkbook.SaveAs FileName:=outFile
xlApp.DisplayAlerts = True
.Quit
End With