set PageSetup.PrintArea from MS Project

S

SoftwareTester

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top