Is there a better way?

G

Guest

Guest
I am usiing the Marco below to set the page orientation, gridlines and paper size. Is there a better way to do this? This seems to take a long time to run. Thanks

Sub setpage()
With ActiveSheet.PageSetup
'.LeftHeader = ""
'.CenterHeader = ""
'.RightHeader = ""
'.LeftFooter = ""
'.CenterFooter = ""
'.RightFooter = ""
'.LeftMargin = Application.InchesToPoints(0.75)
'.RightMargin = Application.InchesToPoints(0.75)
'.TopMargin = Application.InchesToPoints(1)
'.BottomMargin = Application.InchesToPoints(1)
'.HeaderMargin = Application.InchesToPoints(0.5)
'.FooterMargin = Application.InchesToPoints(0.5)
'.PrintHeadings = False
.PrintGridlines = True
'.PrintComments = xlPrintNoComments
'.PrintQuality = 300
'.CenterHorizontally = False
'.CenterVertically = False
.Orientation = xlLandscape
'.Draft = False
.PaperSize = xlPaperLegal
'.FirstPageNumber = xlAutomatic
'.Order = xlDownThenOver
'.BlackAndWhite = False
'.Zoom = 100
End With
'ActiveWindow.SelectedSheets.PrintPreview
End Sub
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi

Just a way can you not defaul Excel to these requirements and hit PRINT all ill done.

or in VBA if you must

ActiveSheet.PrintOut


This will save the agro, or am i missing something?
 
Upvote 0
Tested your code took 1 or 2 seconds >>>>

I stilk with what isaid default and try . see if quicker, if networked can be slower lazer to fire and all the rest.

the reason i suggested this is no one seems to know but Excel cant print as such, so tells windows to kick the print manager and so prints. Now even worse is evertime we prints Excel tell Windows and windows goes off checking drivers and them checks print mamagers request and them after a 3 cource dinner decids OK ill print, thus the loops, but take note thisis done ever time we print, i say why cant Windows remember???? save the checks.

Now driver play the big part if slow a defaul print will test, is the same the printer config or driver might need updating, latist drivers are not always the best as we all know compatablity is the key.

If networked, then send to another printer on VBA and default see if inprovements happen, thsi is called know testing... and so gives tangable guidlines.

hope you get sucess.
 
Upvote 0
Try this :-

Sub setpage()
With ActiveSheet.PageSetup
Application.ExecuteExcel4Macro ("PAGE.SETUP(,,,,,,,1,,,2,5)")
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top