在Excel VBA中确定打印页面的大小

时间:2009-11-30 20:48:56

标签: excel vba excel-vba

在Excel中,有没有办法确定打印页面的宽度?

示例伪代码如下:

Dim remainingWidth as Double

remaningWidth = <property that gives printed page width> - _  
                ActiveSheet.PageSetup.LeftMargin - _  
                ActiveSheet.PageSetup.RightMargin - _  
                Range("A:H").Width  

1 个答案:

答案 0 :(得分:1)

Here are all the members of PageSetup.。我最初的想法是编写一个函数,它接受Orientation和PaperSize并返回页面宽度。例如:

If ActiveSheet.Orientation = xlLandscape And ActiveSheet.PaperSize = xlPaperLetter Then
    dblPaperWidth = 15840 '11 inches in twips
Else
    ...
End If