Macro became slow

maremalin

New Member
Joined
Sep 5, 2014
Messages
5
Hello,
i'm using macro to speed up printint to one page process as i print a big number of documents daily.
It worked good but for some reasons it takes considerably longer now to run - making it pointless to use.
Can anyone spot anything wrong with it:

Sub Macro1()
'

' Keyboard Shortcut: Ctrl+t
'
Application.ScreenUpdating = False
Application.EnableEvents = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.166645835937175)
.RightMargin = Application.InchesToPoints(0.166645835937175)
.TopMargin = Application.InchesToPoints(0.166645835937175)
.BottomMargin = Application.InchesToPoints(0.166645835937175)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsNA
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub




Apprieciate any comments/ suggestions
Please let me know if you need more info
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
If you are using Excel 2010 or later try

Rich (BB code):
Sub Macro1()
'

' Keyboard Shortcut: Ctrl+t
'
Application.ScreenUpdating = False
Application.EnableEvents = False
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.166645835937175)
.RightMargin = Application.InchesToPoints(0.166645835937175)
.TopMargin = Application.InchesToPoints(0.166645835937175)
.BottomMargin = Application.InchesToPoints(0.166645835937175)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsNA
End With
Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintPreview
End Sub
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Then, sorry there isn't much that you can do about the slowness. Excel communicates with the printer driver for every line of code that set the print properties.
 
Upvote 0

maremalin

New Member
Joined
Sep 5, 2014
Messages
5
Then, sorry there isn't much that you can do about the slowness. Excel communicates with the printer driver for every line of code that set the print properties.

right
i have used this macro for few years and it worked spot on
It slowed down recently. I have not made ancy changes to PC
Do you think this could be related to printer's driver?

Just trying to get down to what could have caused that
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
If you (or Windows) have changed the printer driver that could have affected the speed of the macro.
 
Upvote 0

maremalin

New Member
Joined
Sep 5, 2014
Messages
5
Thank you for your advice.
I have changed default printer and macro works like before!

thank you again
 
Upvote 0

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
59,294
Office Version
  1. 365
Platform
  1. Windows
Thank you for your advice.
I have changed default printer and macro works like before!

thank you again
It's a bit fiddly but I have used what you have done manually in the macro in the past with older excel versions.

The process is ..

- Determine the current printer and store that info in a variable
- Have the macro change the current printer to one that doesn't have the speed problem
- Do the page setup
- Use the stored info to return the current printer to what is was at the start of the macro.
 
Upvote 0

maremalin

New Member
Joined
Sep 5, 2014
Messages
5
Just to keep you up to date.
I have tried removing printer, updating driver but that didn't work
so i have decided to drastically simplyfy macro.

This is what works for me and it works FAST:

Sub Macro1()
'
'
' Keyboard Shortcut: Ctrl+t
'
Application.ScreenUpdating = False
Application.EnableEvents = False
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
.Zoom = False
End With
ActiveWindow.SelectedSheets.PrintPreview
End Sub
 
Upvote 0

Forum statistics

Threads
1,190,631
Messages
5,982,029
Members
439,750
Latest member
megaman777

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
Top