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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to generate report as excel file?

Status
Not open for further replies.

Lyubomyr

Programmer
Jul 23, 2005
21
UA
Hi!
I have a need to output my report data into MS Excel file.
(Which should be generated at runtime.)
I know how to do it in VBA 6.0. But I spent 3 hours and havent't done anything.

Please help.
I don't really care if it would be VB.net or C#.net

Thank you in Advance
 
if you can do it in vb6.0 then you can do it in vb.net.

Just show us some code that doesn't work

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
I've done this in the past by just saving comma seperated data with line breaks at the end of rows. Then name the file with a .xls extension. Unless your trying to output formulas or something complex this should do it.
 
I'm doing something like this
Code:
Dim xlApp as Excel.Application
Dim xlWb as Excel.Workbook
Dim xlS as Excel.Worksheet

Set  xlApp = CreateObject("Excel.Applicatio")
xlApp.SheetsInNewWorkbook= 1
Set xlWB = xlApp.Worbook.Add
Set xlS.name=rstTask!FullName
...............................

Something like this!
problem #1 I cant find the refernce which has Excel.Application class.

In VB6.0 it has reference called as
Microsoft Excel 11.0 Object Librery
 
did you do this?

Imports Microsoft.Office.Interop

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Sorry for stupid question.
But How can I import Microsoft.Office.Interop,I don't know which file contains that component

Please help
 
you add a reference to the com object microsoft excel 11.0 object library and then you put the above mentioned line above the public class line.

Christiaan Baes
Belgium

I just like this --> [Wiggle] [Wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top