Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing Excel file

Status
Not open for further replies.

Nanda

Programmer
Nov 14, 2000
104
0
0
US
Hi There!

My issue is..
I want to write an Excel file thru ASP/VB SCript code. Whenever I try to create an instance of Excel, I get error "ActiveX cannot create component: Excel".

Unable to figure out, what is the reason. Excel 97 is installed on NT with IIS4.0

Code is like......
<script language=&quot;vbscript&quot;>
Sub btnExcel_onclick()
dim objXL
Set objXL = CreateObject(&quot;Excel.Application&quot;)
objXL.Visible = TRUE
objXL.WorkBooks.Add

objXL.Columns(1).ColumnWidth = 25
objXL.Columns(2).ColumnWidth = 25
objXL.Columns(3).ColumnWidth = 30

objXL.Rows(&quot;1:1&quot;).Select
objXL.Selection.Font.Bold = True

objXL.Cells(1, 1).Value = &quot;Insurance&quot;
objXL.Cells(1, 2).Value = &quot;Medical&quot;
objXL.Cells(1, 3).Value = &quot;Total&quot;
objXL.Cells(2, 1).Value = 38982
objXL.Cells(2, 2).Value = 3834
objXL.Cells(2, 3).Value = &quot;=SUM(A2/B2)&quot;
End Sub
</script>

Any help, I am greatful.
Thank you
Nanda
 
This is a security issue, the thing is that the IIS and excel run in different memory compartements.. so you need to run excel in out-of-process, for that you'll need to create an activeX dll and registerit in MTS to run and create the excel file...

check this article on how to do it..:

Silvers5
As seen on EE
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top