View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vkarumbaiah Vkarumbaiah is offline
external usenet poster
 
Posts: 3
Default Unable to set the PaperSize property of the PageSetup class

Tom
this may be a silly question but, how can I assign a printer to a User ?
thnaks

Vikram

"Tom Ogilvy" wrote:

It sounds like the User ID you are using doesn't have a printer assigned.

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
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.x lPaperLetter,
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(Strin g
memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes,
MessageData& msgData)
at
Microsoft.Office.Interop.Excel.PageSetup.set_Paper Size(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.