I have an array of data which I would like to dump into an excel file, how is this done ?
Printable View
I have an array of data which I would like to dump into an excel file, how is this done ?
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)
Thanks for your help.