Hi,
How can I output a report into an Excel spread sheet? Do I need a data control for it?
More importantly can I manipulate a spreadsheet cell by cell through a VB program?
Thanks in advance.
Printable View
Hi,
How can I output a report into an Excel spread sheet? Do I need a data control for it?
More importantly can I manipulate a spreadsheet cell by cell through a VB program?
Thanks in advance.
1. Don't know about the report - I never use the built in report engine - you can export to HTML or Text so Excel might be available. Check the DataReport ExportFormat meth in VB Help.
2. You can certainly manipulate Excel cell by cell from a VB program.
The trick is to use Excel to do it. Set a reference to the Excel Object Library and then use something like:
oExcel will give you access to all of Excels internal methods, Cells, Range etc...Code:Dim oExcel as Excel.Application
Set oExcel = New Excel.Application
With oExcel
.LoadsaMethodsAvailable....
Good luck.
Paul.
Here“s the code I use for Excel:
dim X aS OBJECT
Set X = CreateObject("Excel.Sheet")
X.Application.Visible = True
X.ActiveSheet.Rows(int_Row).Font.Bold = True 'fontbold
X.ActiveSheet.Cells(int_Row, Col).Formula = "'Hello"
X.ActiveSheet.Cells(int_Row, Col).Formula = 123
X.ActiveSheet.Cells.Font.Size = 8
X.ActiveSheet.Cells.Columns.AutoFit
X.SaveAs App.Path & "\myfile.xls"
To get more, save a macro in excel with what you want to do and open the code!
Thanks guys.