简体   繁体   English

Excel VBA调整打印区域大小

[英]excel vba resizing print area

I have an excel tool that was made by someone before me. 我有一个由我之前的人制作的Excel工具。 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. 但是,在制作该工具时,它会将工作表输出到适合excel 2007中可打印区域的特定大小。但是,在excel 2010中,大小调整不可用。 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? 如何更改工作表中打印区域的大小,而不必更改每张工作表中单个单元格的大小?

Thanks for anyone who can offer their 2 cents. 感谢任何能提供2美分的人。

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. 我可以根据要求做到最好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM