Link to home
Start Free TrialLog in
Avatar of ian_khoo_sc
ian_khoo_sc

asked on

Unable to use Excel.Application

Hi All,

I try to use Dim oExcel As New Excel.Application for my web application using VB.NET.
But it give me following error
System.UnauthorizedAccessException: Access is denied. at Orders.GetDeliverySchedule.getfile() in c:\inetpub\wwwroot\Orders\GetDeliverySchedule.aspx.vb:line 44 at Orders.GetDeliverySchedule.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\Orders\GetDeliverySchedule.aspx.vb:line 36

I had Imports Excel library into my program reference.

The OS running on my server which is using for deployment is Window Server 2003. Then it willl give me the error msg above.
But if i use my development PC which running on Win XP. Then i will be able to run and generate the excel file without any error.

Can anyone advice, what should i do?
Avatar of vb_jonas
vb_jonas
Flag of Sweden image

You will need MS Excel to be installed and runnable on the computer where the app runs.

If it is a problem with different versions of Excel, I would suggest you to use late binding instead, (and remove the reference to Excel).

Dim oApp as Object
oApp=CreateObject("Application.Excel")

Dim oSheet as Object
oSheet=oApp.Worksheets.Add

...
Avatar of navalarya1982
navalarya1982

Do you have excel installed in your server? Also try using some alternate method to generate excel instead.
Avatar of ian_khoo_sc

ASKER

Yes. I had installed excel into my server.
I had try 2 version of excel. First time i install in excel 97.
But it still not working.
Then i add in Excel 2002.

I guess it not realated to excel version but with permission for you to run some other process. Here excel is other process which you are trying to use in ur web app. Why dont u try to go with method to export to excel without using. I think you can get tons of them easily.
Can you provide a simple example?
Thanks for your help
What are you exporting to excel ? a datagrid?

try searching EE you can get tons of examples.

one of them is here..

https://www.experts-exchange.com/questions/21587480/EXPORT-TO-EXCEL.html
ASKER CERTIFIED SOLUTION
Avatar of vjc2003
vjc2003

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial