VBA open as report in landscape

The_Kurgan

Active Member
Joined
Jan 10, 2006
Messages
270
I am currently using the code below to open a table as a report. It defaults to Portrait, but I would like it to open in landscape orientation. Any ideas how to do that?

Code:
DoCmd.OpenTable "MyTable", acViewPreview, acReadOnly

TIA!
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
That is actually opening the Table as a Table, not as a Report.
I don't think you have the ability to edit how the Table is presented.
Why not just make a simple Report based on the Table, and then you can edit the Report properties as you like?
 
Upvote 0
Interesting, because when I use the code
Code:
DoCmd.OpenTable "MyTable", acViewPreview, acReadOnly
it looks like a report.


When I use
Code:
DoCmd.OpenTable "MyTable", acViewNormal, acReadOnly
it looks like a table.


I haven't programmed an automated report yet, so I will look into that. Thanks!
 
Upvote 0
Follow the commands - they tell you what is going on:
OpenTable - you are opening a table
acViewPreview
- you are opening it in Print Preview mode

The Action for opening reports is called OpenReport.

If you open the Table, and the click on Report from the Create menu, it will automatically create a report for you, which you can then customize to your likely (so you do not have to create the Report from scratch, unless you want to).
 
Upvote 0

Forum statistics

Threads
1,215,758
Messages
6,126,702
Members
449,331
Latest member
smckenzie2016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top