ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   set PageSetup.PrintArea from MS Project (https://www.excelbanter.com/excel-programming/434895-set-pagesetup-printarea-ms-project.html)

SoftwareTester

set PageSetup.PrintArea from MS Project
 
I'm using VBA from MS Project 2003.

I create an Excel sheet, write data to it and all works well.

Now, after writing data to it I want to set a printarea and I try the usual

with xlsheet '// being the Excelsheet creatd from MS Project
with .PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$3:$N$158" '// Some address
end with
end with

while running it stops at the .Orientation statement with Error 1004
"Unable to set the Orientation property of the PageSetup class"

Adding .Activate doesn't make a difference

What could cause this problem and how to solve it?

Patrick Molloy[_2_]

set PageSetup.PrintArea from MS Project
 
try using the number 2 instead of xlLandscape


"SoftwareTester" wrote:

I'm using VBA from MS Project 2003.

I create an Excel sheet, write data to it and all works well.

Now, after writing data to it I want to set a printarea and I try the usual

with xlsheet '// being the Excelsheet creatd from MS Project
with .PageSetup
.Orientation = xlLandscape
.PrintArea = "$A$3:$N$158" '// Some address
end with
end with

while running it stops at the .Orientation statement with Error 1004
"Unable to set the Orientation property of the PageSetup class"

Adding .Activate doesn't make a difference

What could cause this problem and how to solve it?



All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com