问题描述
在MS Project 2003中使用VBA,我创建了一个Excel工作表并将数据写入其中.之后,我想更改我创建的工作表的SetPrintArea和Orientation,所以我写了
Using VBA in MS Project 2003 I create an Excel sheet and write data to it.After that I want to change SetPrintArea and Orientation of the sheet I created so I wrote
with xlsheet '// Defined being an Excel.Worksheet
For i = 1 To .UsedRange.Columns.Count
.Columns(i).EntireColumn.AutoFit
Next i
txtPrintArea = txtPrintArea & "$" & xlCol.Row '// I created the range to print before
With .PageSetup
.Orientation = xlLandscape
.PrintArea = xlSheet.UsedRange.Address
End With
End With
它在.Orientation语句时崩溃.如果我对此发表评论,它将在.PrintArea行崩溃.我的结论是无法设置.PageSetup
It crashes at the .Orientation statement.If I comment that out it crashes at the .PrintArea line.My conclusion is it can't set any property of .PageSetup
如何指定PrintArea?
How can I specify the PrintArea ?
推荐答案
我安装了BullZip PDF打印机,然后.PageSetup.Orientation工作.因此,PageSetup似乎需要安装打印机.
I installed BullZip PDF printer and after that .PageSetup.Orientation works.So it seems PageSetup NEEDS a printer to be installed.
这篇关于无法从MS Project中设置PageSetup.Orientation = xlLandscape的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!