Error 1004 - unable to set the orientation of the page setup class

E

E Sullivan

Hi,

I have a VB6 programming accessing excel. I had previously had no trouble
setting the orientation of the sheet but now that I have a windows xp, I am
getting the above error. I have Office 97 installed on my machine.

thanks
 
T

Tom Ogilvy

Do you have a valid reference to the Excel application in Tools=>References.
It is possible that you don't. If you are are talking about printing out
orientation portrait or landscape, the constants are

? xlLandscape
2
? xlPortrait
1

But I the weren't defined (no reference to the excel object library), they
would be seen as a value of Zero which would probably raise the error you
describe.
 
B

Bob Flanagan

E, is the default printer set to a printer that allows the orientation to be
changed? I've run into the problem before when the default printer is the
not the one I thought it was...

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
E

E Sullivan

I think I figured it out. I'm not attached to a printer. In regular excel, I
can't open the page setup because of that so that is what I'm guessing. It's
not easy for me right now to attach to a printer and this code has been
working for years, so I'm just going to trap the error and move on.
 

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