Dear All,
I have a vba to do page set-up:
*Left, Top, Right, Bootom as 0.5
*Header and Footer as 0.2
Once vba is run page set-up is ok ie margins but when printed Left and right margins are not 0.5cm.
Could you please help me to solve this mystery?
Your help would be greatly appreciated.
Kind Regards,
Biz
I have a vba to do page set-up:
*Left, Top, Right, Bootom as 0.5
*Header and Footer as 0.2
Once vba is run page set-up is ok ie margins but when printed Left and right margins are not 0.5cm.
Could you please help me to solve this mystery?
Code:
Sub Print_Format()
Dim myRange As String
myRange = Selection.Address
ActiveSheet.PageSetup.PrintArea = myRange
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.2)
.FooterMargin = Application.InchesToPoints(0.2)
.PaperSize = xlPaperA4
.Orientation = xlPortrait 'xlLandscape
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True 'Print Preview
'ActiveWindow.SelectedSheets.PrintOut Copies:=1 'Printout
End Sub
Your help would be greatly appreciated.
Kind Regards,
Biz