2009-11-30 77 views
0

在Excel中VBA有沒有一種方法可以確定打印頁面單位的寬度?在Excel VBA中確定打印頁面的大小

實施例的僞代碼如下:

Dim remainingWidth as Double 

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

回答

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