PDA

Click to See Complete Forum and Search --> : Excel questions


cedx
Nov 8th, 2000, 10:05 PM
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.

paulw
Nov 9th, 2000, 04:16 AM
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:


Dim oExcel as Excel.Application
Set oExcel = New Excel.Application

With oExcel
.LoadsaMethodsAvailable....



oExcel will give you access to all of Excels internal methods, Cells, Range etc...

Good luck.

Paul.

jp_schwartz
Nov 9th, 2000, 10:00 AM
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!

cedx
Nov 10th, 2000, 02:55 AM
Thanks guys.