【发布时间】:2011-05-20 19:54:28
【问题描述】:
在 Excel 对象库中是否有设置打印首选项以打印整个工作簿而不是活动工作表的界面?
【问题讨论】:
标签: c++ printing automation excel
在 Excel 对象库中是否有设置打印首选项以打印整个工作簿而不是活动工作表的界面?
【问题讨论】:
标签: c++ printing automation excel
不,PageSetup 仅适用于工作表
你能做的最好的就是复制所需设置的宏
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
【讨论】: