'Begining of file: '
'SUBSaveData.txt '
'Save in your VB '
'App.Path for this '
'example
''''''''''''''''''''
Sub SaveData(aData() as variant)
dim i as integer
With sheets("Sheet1")
'''Your For...Next can be changed to fit
'''your array coming in.
For i = 1 To UBound(aData, 1) + 1
.Cells(i, 1).Value = aData(i-1)
Next i
End With
End Sub
''''''''''''''''''
'End of Text File'
''''''''''''''''''
' **** This Code is in your VB App ***
' Don't forget to set a reference to the
' Microsoft Excel #.0 Object Library
Private Sub SaveDataToXL()
Dim myXL as Excel.Application
Dim aData() as Variant
Set myXL = New Excel.Application
myXL.Visible = True ' So we can see
' Excel
myXL.ScreenUpdating = False 'Speed it up
myXL.Workbooks.Add
With myXL.ActiveWorkbook
.Sheets.Add , , , xlModule
.Sheets("Module1").InsertFile _
App.Path & "SUBSaveData.txt", True
End With
aData = Array(1,3,2,45,2,45,3,4,"other stuff") 'Adjust your VBA sub
'to suit your array
myXL.Run "SaveData", aData()
myXL.ScreenUpdating = True
End Sub