WorkSheet.PageSetup.CHartSize Property

J

JaedenRuiner

Okay,

Well, I've automated quite a bit with excel and every so often one of these
really annoying glitches pops up. I'm using Office 2003, all with latest
service packs and everything, and basically I usually end up creating a lot
of applications which automate excel, processing database information and
exporting it etc, etc, etc.

I currently have finalized this most recent export process, which exports a
moderately sized table into excel for the user to work with, but I wanted to
adjust the printing area appropriately.

SO, I set the PrintArea to the A1:K47 string, I set the FittoPagesTall/Wide
to 1 and the Orientation to Landscape, and all of this is perfectly
functional from my 2008 .Net 3.5 application. But in the open application
window of the file i'm automatically creating, the page divider lines still
show 4 pages of data. Now, I said to myself, i know that in the Page Setup
Dialog I can set "Fit to Page" and it automatically adjusts the zoom factor
(scaling) to fit the print area onto 1x1 pages.

The only property in the WorkSheet.PageSetup that appears to do this is the
ChartSize property, but when I step over that line in the Application I'm
debugging, I get the Exception:
"Unable to set the ChartSize property of the PageSetup class"

Now the only thing i've seen online about this error from Microsoft says it
could occur when a printer isn't installed. That is not the case here.

I further looked up in the property and it said something about only being
applied to "Chart Sheets" but when I try to use the workbook.worksheets.add()
method witht the Type set to xlChart I get a com object disconnected from RCW
error.

NOw, I can manually go into the Page Setup Properties for the Excel
Worksheet, and set the "FIt to Page" there, so How can I forcibly automate
this exact same process without having to open the Excel APplicaiton.

Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
 

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