Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Page Setup Macro

Hi There,

I recorded a simple page set up Macro (see below), but it takes forever
to run, like at least a minute. Is that because of the "application
inches to points...?"
If anyone knows how I can achieve this page setup in a shorter time via
a macro would appreciate it.


Sub Page_setup_Final_matched()
'
' Page_setup_Final_matched

Range("C2").Select
ActiveWindow.FreezePanes = True
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$A:$R"
With ActiveSheet.PageSetup

.CenterHeader = "&""Arial,Bold""&12PHAC matched to Data"

.LeftFooter = "&""Arial,Bold Italic""&8printed on &D at &T"
.CenterFooter = "&""Arial,Bold""Page &P of &N"
.RightFooter = "&""Arial,Bold Italic""&8File: &F, Tab:&A"
.LeftMargin = Application.InchesToPoints(0.354330708661417)
.RightMargin = Application.InchesToPoints(0.354330708661417)
.TopMargin = Application.InchesToPoints(0.551181102362205)
.BottomMargin = Application.InchesToPoints(0.54)
.HeaderMargin = Application.InchesToPoints(0.275590551181102)
.FooterMargin = Application.InchesToPoints(0.25)

.Orientation = xlLandscape

.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic

.Zoom = 80
.PrintErrors = xlPrintErrorsDisplayed
End With
Range("C10").Select
End Sub




*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Page Setup Macro

Darin,

Changing PageSetUp is notoriously slow.
Only change the settings that need changing.
If the default settings are close enough, don't change them.
Set the display of pagebreaks to false.
There are 72 points to the inch.
Possibly...
'-----------------------
Sub Page_setup_Final_matched()
Range("C2").Select
ActiveWindow.FreezePanes = True
ActiveSheet.DisplayPageBreaks = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintArea = "$A:$R"
.CenterHeader = "&""Arial,Bold""&12PHAC matched to Data"
.LeftFooter = "&""Arial,Bold Italic""&8printed on &D at &T"
.CenterFooter = "&""Arial,Bold""Page &P of &N"
.RightFooter = "&""Arial,Bold Italic""&8File: &F, Tab:&A"
.LeftMargin = 25
.RightMargin = 25
.TopMargin = 40
.BottomMargin = 39
.HeaderMargin = 20
.FooterMargin = 18
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = 80
End With
Range("C10").Select
End Sub
'---------------------------------

Regards,
Jim Cone
San Francisco, USA




"Darin Kramer" wrote in message
...
Hi There,
I recorded a simple page set up Macro (see below), but it takes forever
to run, like at least a minute. Is that because of the "application
inches to points...?"
If anyone knows how I can achieve this page setup in a shorter time via
a macro would appreciate it.

Sub Page_setup_Final_matched()
' Page_setup_Final_matched
Range("C2").Select
ActiveWindow.FreezePanes = True
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$A:$R"
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Bold""&12PHAC matched to Data"

.LeftFooter = "&""Arial,Bold Italic""&8printed on &D at &T"
.CenterFooter = "&""Arial,Bold""Page &P of &N"
.RightFooter = "&""Arial,Bold Italic""&8File: &F, Tab:&A"
.LeftMargin = Application.InchesToPoints(0.354330708661417)
.RightMargin = Application.InchesToPoints(0.354330708661417)
.TopMargin = Application.InchesToPoints(0.551181102362205)
.BottomMargin = Application.InchesToPoints(0.54)
.HeaderMargin = Application.InchesToPoints(0.275590551181102)
.FooterMargin = Application.InchesToPoints(0.25)
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Zoom = 80
.PrintErrors = xlPrintErrorsDisplayed
End With
Range("C10").Select
End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Page Setup Macro

Here's a thread that addresses the same problem:

http://groups.google.com/groups?thre...GP12.phx. gbl

Two tips are included--only adjust the parms you need to adjust.

Use the John Green version (XLM works faster than VBA in this situation).

(posted by Tom Ogilvy and Ron de Bruin)

Darin Kramer wrote:

Hi There,

I recorded a simple page set up Macro (see below), but it takes forever
to run, like at least a minute. Is that because of the "application
inches to points...?"
If anyone knows how I can achieve this page setup in a shorter time via
a macro would appreciate it.

Sub Page_setup_Final_matched()
'
' Page_setup_Final_matched

Range("C2").Select
ActiveWindow.FreezePanes = True
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$A:$R"
With ActiveSheet.PageSetup

.CenterHeader = "&""Arial,Bold""&12PHAC matched to Data"

.LeftFooter = "&""Arial,Bold Italic""&8printed on &D at &T"
.CenterFooter = "&""Arial,Bold""Page &P of &N"
.RightFooter = "&""Arial,Bold Italic""&8File: &F, Tab:&A"
.LeftMargin = Application.InchesToPoints(0.354330708661417)
.RightMargin = Application.InchesToPoints(0.354330708661417)
.TopMargin = Application.InchesToPoints(0.551181102362205)
.BottomMargin = Application.InchesToPoints(0.54)
.HeaderMargin = Application.InchesToPoints(0.275590551181102)
.FooterMargin = Application.InchesToPoints(0.25)

.Orientation = xlLandscape

.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic

.Zoom = 80
.PrintErrors = xlPrintErrorsDisplayed
End With
Range("C10").Select
End Sub

*** Sent via Developersdex http://www.developersdex.com ***


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page Setup Macro runs slow William G Excel Discussion (Misc queries) 3 March 31st 09 07:31 PM
What does &L& mean in a page setup macro? Bonnie June Excel Worksheet Functions 1 July 26th 06 11:29 PM
Macro for Page Setup - Repeat rows at top epuk Excel Programming 2 April 1st 05 04:23 AM
Excel Print Page setup macro... hord Excel Programming 0 January 22nd 04 01:01 AM
Recording Page Setup macro Scott Excel Programming 3 December 5th 03 12:37 AM


All times are GMT +1. The time now is 11:42 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"