开发者

Determining size of printed page in Excel VBA

开发者 https://www.devze.com 2022-12-13 08:52 出处:网络
In Excel VBA is there a way to determine the width in units of a printed page? Example pseudo-code is as follows:

In Excel VBA is there a way to determine the width in units of a printed page?

Example pseudo-code is as follows:

Dim remainingWidth as Double

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


Here are all the members of PageSetup.. My initial thought is to write a function that takes in Orientation and PaperSize and returns the page width. For example:

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

精彩评论

暂无评论...
验证码 换一张
取 消