I need a code sample using VB ASP.Net 2003 which exports a tab delimited text
file resident on the server into an Excel spreadsheet which will be saved
through the browser to the client's local workstation. I don't need examples
of a Windows application where everything is local.
I've tried KB306022 which doesn't work. I've included references to
Microsoft.Offic e.Core and Microsoft Excel 11.0 Object Library. When I try to
use the CreateObject("E xcel.Applicatio n") function I get the message "Can't
create ActiveX component".
I can't find anything relevant to my problem in MSDN. I have a client
wondering when I'm going to deliver his software.
The little test code I've written so far follows:
Imports Microsoft.Offic e.Core
Public Class Workbooks
Inherits System.Web.UI.P age
Dim TAB As String = Chr(9)
Private Sub MonthlyReportWB ()
Dim FileNumber As Integer
Dim MyMonthlyReport As String
Dim tmp As String
Dim xls As Object
MyMonthlyReport = "MyMonthlyRepor t" & Session("UserID ")
FileNumber = FreeFile()
FileOpen(FileNu mber, Session("TempDi r") & MyMonthlyReport & ".TXT",
OpenMode.Output )
tmp = "XXXXXXXXXXXXXX XXXXXXXXX" & TAB & "YYYYYYYYYYYYYY YYYYYYYY" &
TAB & "ZZZZZZ"
PrintLine(FileN umber, tmp)
tmp = TAB & TAB & "UUUUUUUUU" & TAB & "MMMMMMMMMMMMMM "
PrintLine(FileN umber, tmp)
FileClose(FileN umber)
xls = CreateObject("E xcel.Applicatio n")
xls.workbooks.o pentext(Session ("TempDir") & MyMonthlyReport &
".TXT", , , , -4142, , True)
xls.activeworkb ook.saveas(Sess ion("TempDir") & MyMonthlyReport &
".XLS", -4143)
xls.quit()
etc ...
Notice the references to xls in the code above do not result in Intellisense
corrections to case.
Please help. I am extremely frustrated and will lose a client if I can't get
something running here!!
Help!!
Frank Fox
frankvfox@hotma il.com
file resident on the server into an Excel spreadsheet which will be saved
through the browser to the client's local workstation. I don't need examples
of a Windows application where everything is local.
I've tried KB306022 which doesn't work. I've included references to
Microsoft.Offic e.Core and Microsoft Excel 11.0 Object Library. When I try to
use the CreateObject("E xcel.Applicatio n") function I get the message "Can't
create ActiveX component".
I can't find anything relevant to my problem in MSDN. I have a client
wondering when I'm going to deliver his software.
The little test code I've written so far follows:
Imports Microsoft.Offic e.Core
Public Class Workbooks
Inherits System.Web.UI.P age
Dim TAB As String = Chr(9)
Private Sub MonthlyReportWB ()
Dim FileNumber As Integer
Dim MyMonthlyReport As String
Dim tmp As String
Dim xls As Object
MyMonthlyReport = "MyMonthlyRepor t" & Session("UserID ")
FileNumber = FreeFile()
FileOpen(FileNu mber, Session("TempDi r") & MyMonthlyReport & ".TXT",
OpenMode.Output )
tmp = "XXXXXXXXXXXXXX XXXXXXXXX" & TAB & "YYYYYYYYYYYYYY YYYYYYYY" &
TAB & "ZZZZZZ"
PrintLine(FileN umber, tmp)
tmp = TAB & TAB & "UUUUUUUUU" & TAB & "MMMMMMMMMMMMMM "
PrintLine(FileN umber, tmp)
FileClose(FileN umber)
xls = CreateObject("E xcel.Applicatio n")
xls.workbooks.o pentext(Session ("TempDir") & MyMonthlyReport &
".TXT", , , , -4142, , True)
xls.activeworkb ook.saveas(Sess ion("TempDir") & MyMonthlyReport &
".XLS", -4143)
xls.quit()
etc ...
Notice the references to xls in the code above do not result in Intellisense
corrections to case.
Please help. I am extremely frustrated and will lose a client if I can't get
something running here!!
Help!!
Frank Fox
frankvfox@hotma il.com
Comment