Dim sSQL As String
Dim objXL As Object
Dim objWB As Object
Dim sFile As String
Dim sShtName As String
Dim i As Integer
'Set name of file to save to
sFile = "C:\ANOMALIES.XLS"
'Set name of new sheet
sShtName = "ANOMALIES"
'Create a new excel document
Set objXL = CreateObject("Excel.Application")
'create new workbook
Set objWB = objXL.Workbooks.Add
'Save as a new file, delete existing file if it exists
If Dir$(sFile) <> "" Then Kill sFile
objWB.SaveAs sFile
objWB.Close
objXL.Quit
'CLOSE DOWN
Set objWB = Nothing
Set objXL = Nothing
|