Hi,
This is the code I am currently using. Problem is that the results are placed in a single column when the exporting to a CSV file. I tried adding the "," but doesn't seem to work.
Sub ExtractResultSet()
Dim DestFile As String
Dim FileNum As Integer
' Prompt user for destination file name.
DestFile = "c:/temp/test.csv"
' Obtain next free file handle number.
FileNum = FreeFile()
' Turn error checking off.
On Error Resume Next
' Attempt to open destination file for output.
Open DestFile For Output As #FileNum
' If an error occurs report it and end.
If Err <> 0 Then
MsgBox "Cannot open filename " & DestFile
End
End If
' Turn error checking on.
On Error GoTo 0
' Loop for each row in selection.
For i = 1 To BaseData.NumberOfObservations
' Write current cell's text to file with quotation marks.
Print #FileNum, i, ",", ModelResults.FittedMu(i), ModelResults.AIC, BaseData.xValue(1, i), BaseData.xValue(2, i), BaseData.xValue(2, i), ModelResults.FitResult
Next i
' Close destination file.
Close #FileNum
End Sub
Thanks in advance!
Bookmarks