Be aware of that the target machine must have MS excell installed for
you to be able to run your program on the target machine. If it
hasn't, maybe you can just do the easier way and export to a tab
delimited format? You also need to add the component "Microsoft Excel
9.0 Object Library" to your project.
ExportData is a matrix.
Public Sub ExportToExcel(exportFileName As String, ByRef ExportData)
' Need Component "Microsoft Excel 9.0 Object Library"
' Declare object variables for Microsoft Excel,
' application workbook, and worksheet objects.
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
' Assign object references to the variables. Use
' Add methods to create new workbook and worksheet
' objects.
Set xlApp = New Excel.Application
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets.Add
' Assign the values Fron double Matrix ExportData to
' Microsoft Excel cells.
Dim DataStartAtRow As Integer
xlApp.DisplayAlerts = False
xlSheet.Cells(1, 1).value = "Hello"
xlSheet.Cells(1, 2).value = "World"
dim DataStartAtRow as integer
DataStartAtRow = 3
xlSheet.Range(xlSheet.Cells(DataStartAtRow, 1), _
xlSheet.Cells(UBound(ExportData, 1) + DataStartAtRow - 1, _
UBound(ExportData, 2))) = ExportData
' Use the Formula method to add the values in
' Microsoft Excel.
' xlSheet.Cells(3, 1).Formula = "=R1C1 + R2C1"
' Save the Worksheet.
xlSheet.SaveAs exportFileName
' Close the Workbook
xlBook.Close
' Close Microsoft Excel with the Quit method.
xlApp.Quit
' Release the objects.
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing
End Sub
Good luck!
/Andreas Lundgren
"dave" <da********@blueyonder.co.uk> wrote in message news:<Ee***************@news-binary.blueyonder.co.uk>...
how do i send and recieve cell values between vb6 and excel. please supply a
sample
thanx