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(e xportFileName 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.Applicati on
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.Applicati on
Set xlBook = xlApp.Workbooks .Add
Set xlSheet = xlBook.Workshee ts.Add
' Assign the values Fron double Matrix ExportData to
' Microsoft Excel cells.
Dim DataStartAtRow As Integer
xlSheet.Range(x lSheet.Cells(Da taStartAtRow, 1), _
xlSheet.Cells(U Bound(ExportDat a, 1) + DataStartAtRow - 1, _
UBound(ExportDa ta, 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" <da009a7228@blu eyonder.co.uk> wrote in message news:<EeAib.386 1$aU.198@news-binary.blueyond er.co.uk>...[color=blue]
> how do i send and recieve cell values between vb6 and excel. please supply a
> sample
>
> thanx[/color]
Comment