开发者

Excel Automation - Print Entire Workbook setting

开发者 https://www.devze.com 2023-03-07 20:48 出处:网络
Within the Excel object library is there an interface to setting the print preferences to print the entire workbook instead of开发者_JAVA技巧 the active sheet?No, PageSetup applies only to sheets

Within the Excel object library is there an interface to setting the print preferences to print the entire workbook instead of开发者_JAVA技巧 the active sheet?


No, PageSetup applies only to sheets

Best you can do is a macro to copy the required settings

Sub CopyPageSetup()
    Dim sh As Worksheet, cl As Range
    Dim shBase As Worksheet

    Set shBase = ActiveSheet
    For Each sh In ActiveWindow.SelectedSheets
        If sh.Name <> shBase.Name Then
            sh.PageSetup.Orientation = shBase.PageSetup.Orientation
            ' Add other PageSetup properties here '
            ' unfortunately sh.PageSetup = shBase.PageSetup does not work '
        End If
    Next

End Sub
0

精彩评论

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