I can't set orientation 
Author Message
 I can't set orientation

I'm trying to format a spreadsheet from an Access program. I have these
lines:

XL.Application.ActiveSheet.Pagesetup.printgridlines = True
XL.Application.ActiveSheet.Pagesetup.zoom = 100
XL.Application.ActiveSheet.Pagesetup.Orientation = xlLandscape

The first two execute perfectly, the third line causes:

Run time error 1004
Unable to set the Orientation property of the PageSetup class

I would appreciate any advice regarding how to make this work.

--
Randy Harris



Thu, 08 Jul 2004 05:14:47 GMT  
 I can't set orientation
If you don't have a reference set to the Excel Object library, then Access
has no way of knowing what the value of xlLandscape is - it just appears to
be an unitialized variant variable.

Use the hardcoded value 2
? xlLandscape
 2

Try prefacing xlLandscape with "Excel"

Excel.xlLandscape

I don't know if this will work or not, but I think it will.

Or set a reference to the Excel Object library.

Regards,
Tom Ogilvy


Quote:
> I'm trying to format a spreadsheet from an Access program. I have these
> lines:

> XL.Application.ActiveSheet.Pagesetup.printgridlines = True
> XL.Application.ActiveSheet.Pagesetup.zoom = 100
> XL.Application.ActiveSheet.Pagesetup.Orientation = xlLandscape

> The first two execute perfectly, the third line causes:

> Run time error 1004
> Unable to set the Orientation property of the PageSetup class

> I would appreciate any advice regarding how to make this work.

> --
> Randy Harris



Fri, 09 Jul 2004 02:07:00 GMT  
 I can't set orientation
That was it, precisely. Thanks Tom, very much.
--
Randy Harris


Quote:
> If you don't have a reference set to the Excel Object library, then Access
> has no way of knowing what the value of xlLandscape is - it just appears
to
> be an unitialized variant variable.

> Use the hardcoded value 2
> ? xlLandscape
>  2

> Try prefacing xlLandscape with "Excel"

> Excel.xlLandscape

> I don't know if this will work or not, but I think it will.

> Or set a reference to the Excel Object library.

> Regards,
> Tom Ogilvy



> > I'm trying to format a spreadsheet from an Access program. I have these
> > lines:

> > XL.Application.ActiveSheet.Pagesetup.printgridlines = True
> > XL.Application.ActiveSheet.Pagesetup.zoom = 100
> > XL.Application.ActiveSheet.Pagesetup.Orientation = xlLandscape

> > The first two execute perfectly, the third line causes:

> > Run time error 1004
> > Unable to set the Orientation property of the PageSetup class

> > I would appreciate any advice regarding how to make this work.

> > --
> > Randy Harris



Fri, 09 Jul 2004 05:20:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Can't see images in Publisher, cans see thumbs in image manager

2. Orientation Setting Problem Running VBA

3. URGENT: Setting PageSetup.Orientation fails on XP

4. Programmatically setting the orientation of tick labels

5. Set Print Orientation to Landscape

6. Set page orientation in code?

7. Setting the page orientation in Access

8. Reports-Permanent Set of Margins/orientation

9. setting orientation of spin button

10. Need code to set paper size and orientation


 
Powered by phpBB® Forum Software © phpBB Group