excel vba 调整打印区域大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9525622/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
excel vba resizing print area
提问by thebiglebowski11
I have an excel tool that was made by someone before me. However, when the tool was made, it would output worksheets to a certain size that would fit the printable area in excel 2007. In excel 2010 however, the sizing is off. How can I change the size of the print area in a worksheet without having to change the size of individual cells in each sheet?
我有一个由我之前的人制作的 excel 工具。但是,在制作该工具时,它会将工作表输出为适合 excel 2007 中的可打印区域的特定尺寸。然而,在 excel 2010 中,尺寸已关闭。如何更改工作表中打印区域的大小而不必更改每个工作表中单个单元格的大小?
Thanks for anyone who can offer their 2 cents.
感谢任何可以提供 2 美分的人。
回答by PatternMatching
I'm assuming that the ability to set the print area to a range of cells programatically will get you where you'd like to be:
我假设以编程方式将打印区域设置为一系列单元格的能力将使您到达您想要的位置:
Dim MyPrintArea As Range
Set MyPrintArea = ActiveSheet.Range("A1:G15")
ActiveSheet.PageSetup.PrintArea = MyPrintArea
Best I could do based upon the ask.
根据要求,我能做的最好。