I'd like to be able to output the content of the labels in my vb program to specific cells in an excel spreadsheet. Can I do so? How?
Thanks
Printable View
I'd like to be able to output the content of the labels in my vb program to specific cells in an excel spreadsheet. Can I do so? How?
Thanks
Make sure that you refrence the MS Excel object library
Here is the code assuming that you have 4 labels
Code:Private Sub Form_Load()
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
'On Error GoTo Err_Handler
' Start Excel and get Application object.
Set oXL = CreateObject("Excel.Application")
oXL.Visible = True
' Get a new workbook.
Set oWB = oXL.Workbooks.Add
Set oSheet = oWB.ActiveSheet
' Add table headers going cell by cell.
oSheet.Cells(1, 1).Value = Label1
oSheet.Cells(1, 2).Value = Label2
oSheet.Cells(1, 3).Value = Label3
oSheet.Cells(1, 4).Value = Label4
End Sub