Automatically Save a CSV File

canam

Board Regular
Joined
Dec 14, 2004
Messages
156
I have a csv file that is being used to collect serial data from a wedge program. The file must be a csv. I would like to save the file automatically every 10 minutes to c:\data.csv using VBA but since I am not able to save code within the file I am not sure if this is possible or where to begin. Any help is greatly appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

gelsner99

New Member
Joined
Apr 24, 2014
Messages
5
I want to save an Excel Worksheet as a CSV file using VBA. And the code I have, will do that, but it also closes the main Excel Workbook. How do I keep it from closing my Workbook. Here's the code: Sub SaveCSVnotExit(sFileName)
Application.DisplayAlerts = False
'---> Save Current workbook just in case latest additions not saved
' ActiveWorkbook.Save
'---> Now create a CSV of the active sheet
ActiveWorkbook.SaveAs Filename:=sFileName, FileFormat:=xlCSV
Application.DisplayAlerts = True
ActiveWorkbook.Close False
'Application.Quit
' Wind up here
Sheets("MyCSV").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,695
Messages
5,988,147
Members
440,130
Latest member
bianca88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top