Click to See Complete Forum and Search --> : Dumping Data into Excel


October 21st, 1999, 10:03 AM
I have an array of data which I would like to dump into an excel file, how is this done ?

October 21st, 1999, 11:38 AM
Finally, something I can help with.
This is the code I use to dump to Excel, don't expect it to be the most
efficient since I am also a beginner programmer but it works fine:

Private Sub Command1_Click()
Set wkbObj = GetObject("C:\VBProjects\Path\File.XLS")
Dim i As Integer
E(40) = CDbl(wkbObj.Worksheets(1).Range("B1").Value)
End Sub

Private Sub Command2_Click()
Set wkbObj = GetObject("C:\VBProjects\Path\File.XLS")

Dim i As Integer
wkbObj.Worksheets(1).Range("B1").Value = E(40)
wkbObj.SaveAs "C:\VBProjects\HobVB\Hob.XLS"
End Sub

You will have to Reference Microsoft Excel Object Library.

I think that will wowk for dumping the variables, if you want to display them in your VB Project you will have to set-up the ADO Link (see Ch.7 VB Programmer's Guide)

October 22nd, 1999, 05:22 AM
Thanks for your help.