I am using Excel to sort the data once I get it into a spreadsheet since that data I get is formatted inconsistently. My problem is that Excel is not unloading from memory. I have tracked it down to the area in red. If I comment this bit of code out
Any ideas? Thanks.
Swi
Code:
With oXLSheet
.Range("A" & CurPos & ":A" & rs.RecordCount + CurPos).CopyFromRecordset rs
[red].Range("A" & CurPos & ":" & CL(i) & rs.RecordCount + CurPos).Sort _
Key1:=Range("A" & CurPos), _
Order1:=xlAscending, _
Header:=xlGuess, _
OrderCustom:=1, _
MatchCase:=True, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers[/red]
End With
Set oXLSheet = Nothing
oXLBook.SaveAs txtReportFile.Text
oXLBook.Close SaveChanges:=False
Set oXLBook = Nothing
oXLApp.Quit
Set oXLApp = Nothing
Any ideas? Thanks.
Swi