Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: VB.NET/Excel Automation Issue-Cannot create ActiveX component.

Reply
Thread Tools

Re: VB.NET/Excel Automation Issue-Cannot create ActiveX component.

 
 
George
Guest
Posts: n/a
 
      06-25-2004
By default ASP.NET account does not have permissions to run an applications like Excel, ...

You must give it using dcomcnfg.exe

Run dcomcnfg.exe and then go to Default Security and let ASPNET account to "Deffault launch" and "Default Access"

George
My Site - Body Jewelry
"Abdullah Haroon Imam" <> wrote in message news:B63B1475-ADB3-46AA-9347-...
Hi,

What am I doing wrong? I created a ASP.NET web application using .NET (Visual Studio 2003) . I am running VB.NET on Windows XP with Excel 2002 also installed on the same machine.

I am getting the following error

System.Exception: Cannot create ActiveX component.

I have following references along with the default ones in my solution

Excel
Microsoft.Office.Core
Microsoft.VisualBasic
Office
System
VBIDE

I copied the following code from MSDN and made some changes to it...here is the code

Sub TestExcel()

Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp =
CreateObject("Excel.Application","\\localhost")
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)

xlSheet.Cells(2, 2) = "This is column B row 2"
xlSheet.Application.Visible = True
xlSheet.SaveAs("C:\Test.xls")
xlApp.Quit()
xlApp = Nothing

End Sub

I mean what am I doing wrong? I even opened MS Excel first and then ran this code...didn't work. I copied the GetExcel and DetectExcel from MSDN into my
code...that didn't work...and yes I tried even with Excel open and GetExcel and DetectExcel in place...not working. Searched on the web...and tried everything
they said...cannot get this thing to work.

I am getting the error "System.Exception: Cannot create ActiveX component." where it says xlApp = CreateObject("Excel.Application","\\localhost"). Any help for the above code will be greatly appreciated.

Thanks,

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX control in python vs ActiveX control in vb 6 (piece of code) vml Python 0 08-22-2007 09:57 AM
Supressing the ctrl-c and other keys during word automation in automation apondu ASP .Net 0 07-19-2007 09:10 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
Re: VB.NET/Excel Automation Issue-System.Exception: Cannot create Acti Trevor Benedict R ASP .Net 0 06-27-2004 05:38 PM
"Automation server can't create object" when creating new page in W2003 Ueslei R. Valentini ASP .Net 1 01-16-2004 12:45 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57