Unable to set the PaperSize property of the PageSetup class

V

vikram29

hi
Im getting an error message. i.e. "Unable to set the PaperSize property
of the PageSetup class"
when I try to set the paper size through code using VB.Net 2003 and MS
Excel 2003.
The code runs in a server side component on an application server and
creates an MS Excel report.

The line at which it fails is as below

oWorksheet.PageSetup.PaperSize =
CType(Microsoft.Office.Interop.Excel.XlPaperSize.xlPaperLetter,
Microsoft.Office.Interop.Excel.XlPaperSize)

The Error and stack trace are as below

Source Exception: Microsoft Office Excel - ForwardCallToInvokeMember
Message: Unable to set the PaperSize property of the PageSetup class
Trace: at System.RuntimeType.ForwardCallToInvokeMember(String
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at
Microsoft.Office.Interop.Excel.PageSetup.set_PaperSize(XlPaperSize )
at ReportServer.cReportServer.ATBSummaryReport(Int32 pATBID, Int16
pRevision, Int32 pAgencyID, Int16 pCompareToRevision) in
C:\reportserver


The printer is a network printer and the drivers are installed on a
network print server which is a seperate machine.
everything works well when the component is configured to run under the
network administrator's login credentials but fails and gives me the
error above when I use an application user's credentials.

I have tried setting the default printer to another printer to rule out
a problem with the printer driver and still get this error.

What should i look for in order to correct this problem?
Thanks for your help in advance.
Vikram.
 

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