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?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Dim oSheet as Object

Do you have excel installed in your server? Also try using some alternate method to generate excel instead.
ian_khoo_scAuthor Commented:
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.

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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.
ian_khoo_scAuthor Commented:
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..

Do you have administrator rights on the machine?.
To Launch Excel Application you need to set the permissions in DCOM Config of the machine.
By default only administrator have the right to launch/activate..
Go to Administrative Tools>Component Services>DCOM Config and see security properties for MS Excel

If you are running this as a webapp you'll need to grant permission to the Internet Guest Account as well.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.