PDA

View Full Version : Fit To pages wide



Djblois
12-26-2006, 08:34 AM
Activesheet.pagesetup.fittopageswide=1

My code just runs through this code but it doesn't change anything. Why is that?

Zack Barresse
12-27-2006, 08:47 AM
Hi Djblois,

Do you set your pages to tall as well? What other code do you use? Have you tried doing this while recording a macro and getting your code?

xld
12-27-2006, 10:10 AM
Any chnace you also have the Zoom property set?

Djblois
12-27-2006, 12:20 PM
Firefyter

I have tried it with code and it sets it to what the correct amount of pages but it doesn't enable it.

XLD

No, I don't have the zoom option on.

Zack Barresse
12-27-2006, 12:30 PM
You didn't really answer all of my questions either. Can you post your code?

Djblois
12-27-2006, 01:46 PM
Sub InvoiceProduct()

'Add Fields to Pivot Table
pt.AddFields RowFields:=Array("Invoice#", "Date", "Customer", "Cust#", "SlsPrsn", "Product", "Price ($)", "Unit Cost ($)")
pt.PivotFields("Date").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("Customer").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("Cust#").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("SlsPrsn").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("Product").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("Price ($)").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)
pt.PivotFields("Unit Cost ($)").Subtotals = Array(False, False, False, False, False, False, _
False, False, False, False, False, False)

With pt.PivotFields("Cases")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Name = "(Cases)"
End With

With pt.PivotFields("Units")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Name = "(Units)"
End With

With pt.PivotFields("Amt ($)")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Name = "(Amt ($))"
End With

With pt.PivotFields("Total Cost ($)")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Name = "(Total Cost ($))"
End With

With pt.PivotFields("Profit ($)")
.Orientation = xlDataField
.Function = xlSum
.NumberFormat = "#,##0"
.Name = "(Profit ($))"
End With

With pt.PivotFields("%")
.Orientation = xlDataField
.Function = xlAverage
.NumberFormat = "0.00%"
.Name = "(%)"
End With

With pt.DataPivotField
.Orientation = xlColumnField
.Position = 1
End With

'Highlight Cust Totals
pvt.Activate
pt.ManualUpdate = False
pt.PivotSelect "Invoice#[All;Total]", xlDataAndLabel, True
Selection.Interior.ColorIndex = 15
Selection.Font.Bold = True

Range("IV2").Select
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToLeft)).Select
With Selection
.HorizontalAlignment = xlCenter
.Font.Bold = True
.Font.ColorIndex = 2
.Interior.ColorIndex = 5
.WrapText = True
End With

'set printheading
With ActiveSheet.PageSetup
.LeftHeader = "&""Arial,Bold""&12Atalanta"
.CenterHeader = "&""Arial,Bold&12""&A"
.LeftFooter = "&""Arial,Bold""&D &T " & Application.UserName
.CenterFooter = "&""Arial,Bold""&F"
.RightFooter = "&""Arial,Bold""Page &P of &N"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.9)
.BottomMargin = Application.InchesToPoints(0.6)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintGridlines = True
.CenterHorizontally = True
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintTitleRows = "$2:$2"
.Orientation = xlLandscape
End With

Range("A3").Select
ActiveWindow.FreezePanes = True
End Sub

That is just some of the code. The whole thing is way too large to post.