Access VBA for Page Setup in Excel

Joined
Apr 3, 2012
Messages
1
Reaction score
0
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:p,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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top