G
Guest
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.Office.Core and Microsoft Excel 11.0 Object Library. When I try to
use the CreateObject("Excel.Application") 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.Office.Core
Public Class Workbooks
Inherits System.Web.UI.Page
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 = "MyMonthlyReport" & Session("UserID")
FileNumber = FreeFile()
FileOpen(FileNumber, Session("TempDir") & MyMonthlyReport & ".TXT",
OpenMode.Output)
tmp = "XXXXXXXXXXXXXXXXXXXXXXX" & TAB & "YYYYYYYYYYYYYYYYYYYYYY" &
TAB & "ZZZZZZ"
PrintLine(FileNumber, tmp)
tmp = TAB & TAB & "UUUUUUUUU" & TAB & "MMMMMMMMMMMMMM"
PrintLine(FileNumber, tmp)
FileClose(FileNumber)
xls = CreateObject("Excel.Application")
xls.workbooks.opentext(Session("TempDir") & MyMonthlyReport &
".TXT", , , , -4142, , True)
xls.activeworkbook.saveas(Session("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
(e-mail address removed)
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.Office.Core and Microsoft Excel 11.0 Object Library. When I try to
use the CreateObject("Excel.Application") 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.Office.Core
Public Class Workbooks
Inherits System.Web.UI.Page
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 = "MyMonthlyReport" & Session("UserID")
FileNumber = FreeFile()
FileOpen(FileNumber, Session("TempDir") & MyMonthlyReport & ".TXT",
OpenMode.Output)
tmp = "XXXXXXXXXXXXXXXXXXXXXXX" & TAB & "YYYYYYYYYYYYYYYYYYYYYY" &
TAB & "ZZZZZZ"
PrintLine(FileNumber, tmp)
tmp = TAB & TAB & "UUUUUUUUU" & TAB & "MMMMMMMMMMMMMM"
PrintLine(FileNumber, tmp)
FileClose(FileNumber)
xls = CreateObject("Excel.Application")
xls.workbooks.opentext(Session("TempDir") & MyMonthlyReport &
".TXT", , , , -4142, , True)
xls.activeworkbook.saveas(Session("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
(e-mail address removed)