J
Jonathan Blitz
I am accessing and Excel workbook from VBA using the following code:
Dim oXL As Excel.Application
Dim oWkb As Excel.Workbook
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
fs.DeleteFile "C:\TEMP\tmp.csv"
On Error GoTo 0
Set oXL = CreateObject("Excel.Application")
Set oWkb = oXL.Workbooks.Open(Filename, , True)
oWkb.SaveAs "C:\TEMP\tmp.csv", xlCSV
oXL.Workbooks.Close
In this way I save the file as a CSV file.
Problem is that when the Close command is issued it prompts the user wether
to save or not (even though it saved just before).
The user can choose NO and it will still work ok.
If the user chooses YES then another screen appears asking for the file name
since tmp.csv already exists.
My question:
How can I prevent the prompt?
--
Jonathan Blitz
AnyKey Limited
Israel
"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
Dim oXL As Excel.Application
Dim oWkb As Excel.Workbook
Dim fs As Object
Set fs = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
fs.DeleteFile "C:\TEMP\tmp.csv"
On Error GoTo 0
Set oXL = CreateObject("Excel.Application")
Set oWkb = oXL.Workbooks.Open(Filename, , True)
oWkb.SaveAs "C:\TEMP\tmp.csv", xlCSV
oXL.Workbooks.Close
In this way I save the file as a CSV file.
Problem is that when the Close command is issued it prompts the user wether
to save or not (even though it saved just before).
The user can choose NO and it will still work ok.
If the user chooses YES then another screen appears asking for the file name
since tmp.csv already exists.
My question:
How can I prevent the prompt?
--
Jonathan Blitz
AnyKey Limited
Israel
"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."