I'm using Bob Larson's Send2Excel module to export query results to Excel spreadsheets. I've made an alteration to set the margins, but it seems like Excel is interpreting my margins perhaps in another measuring system.
This is my code addition:
'Set Margins
ApXL.ActiveSheet.PageSetup.LeftMargin = (0.25)
ApXL.ActiveSheet.PageSetup.LeftMargin = (0.25)
ApXL.ActiveSheet.PageSetup.RightMargin = (0.25)
ApXL.ActiveSheet.PageSetup.TopMargin = (0.75)
ApXL.ActiveSheet.PageSetup.BottomMargin = (0.75)
ApXL.ActiveSheet.PageSetup.HeaderMargin = (0.5)
ApXL.ActiveSheet.PageSetup.FooterMargin = (0.5)
The results are top and bottom margins of 0.0104166666666667, right and left 0.00347222222222222, and header/footers as 0.0104166666666667.
The macro I based my code off of (below) references Application.InchesToPoints. I can't figure out how to get this reference into my code.
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
End With
Has successfully altered inch margins in an Excel export?
This is my code addition:
'Set Margins
ApXL.ActiveSheet.PageSetup.LeftMargin = (0.25)
ApXL.ActiveSheet.PageSetup.LeftMargin = (0.25)
ApXL.ActiveSheet.PageSetup.RightMargin = (0.25)
ApXL.ActiveSheet.PageSetup.TopMargin = (0.75)
ApXL.ActiveSheet.PageSetup.BottomMargin = (0.75)
ApXL.ActiveSheet.PageSetup.HeaderMargin = (0.5)
ApXL.ActiveSheet.PageSetup.FooterMargin = (0.5)
The results are top and bottom margins of 0.0104166666666667, right and left 0.00347222222222222, and header/footers as 0.0104166666666667.
The macro I based my code off of (below) references Application.InchesToPoints. I can't figure out how to get this reference into my code.
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
End With
Has successfully altered inch margins in an Excel export?