B
Brian Reilly, MVP
Hi folks,
I am completing an Excel VBA project that creates custom chart sizes
from a Library of existing pre-formatted charts by using the Move or
Copy Sheet method from the Library file to the current "datafile" (two
separate files. No problems so far.
I am sizing for PPT and various sizes for Word. Two word sizes require
me to reset the Margins to make the page big enough for me to fit a
ChartArea on it at the correct size (measured in Points that are
translated from Inches). This all works but the following function for
re-sizing slows me down in the following code
Public Function Word_PageSetup_FullPage_Horizontal(wkChart As
Excel.Chart)
'6.75" wide x 7.5" high
'slows down here
With wkChart.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
'speed fine here
wkChart.Activate
With wkChart.ChartArea
.Width = 486
.Height = 540
End With
Is there a faster way to do this? Is the PageSetup a sheetspecific
size or if I reset the PageSetup in the Library file, would that copy
over at the right size with the right margins. Doesn't seem to for me.
Note this code works perfectly and gets me the exactly correct chart
sizes. But takes 3-5 seconds to run just this.
Thanks to all my friends over here.
Brian Reilly, PPT MVP
I am completing an Excel VBA project that creates custom chart sizes
from a Library of existing pre-formatted charts by using the Move or
Copy Sheet method from the Library file to the current "datafile" (two
separate files. No problems so far.
I am sizing for PPT and various sizes for Word. Two word sizes require
me to reset the Margins to make the page big enough for me to fit a
ChartArea on it at the correct size (measured in Points that are
translated from Inches). This all works but the following function for
re-sizing slows me down in the following code
Public Function Word_PageSetup_FullPage_Horizontal(wkChart As
Excel.Chart)
'6.75" wide x 7.5" high
'slows down here
With wkChart.PageSetup
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.25)
.BottomMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.25)
.FooterMargin = Application.InchesToPoints(0.25)
End With
'speed fine here
wkChart.Activate
With wkChart.ChartArea
.Width = 486
.Height = 540
End With
Is there a faster way to do this? Is the PageSetup a sheetspecific
size or if I reset the PageSetup in the Library file, would that copy
over at the right size with the right margins. Doesn't seem to for me.
Note this code works perfectly and gets me the exactly correct chart
sizes. But takes 3-5 seconds to run just this.
Thanks to all my friends over here.
Brian Reilly, PPT MVP