You could try this:
This part goes behind the ThisWorkbook module:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Application.OnTime Now + TimeSerial(0, 0, 1), "savecsvnow"
End Sub
This part goes in a general module:
Option Explicit
Sub SaveCSVNow()
Dim wks As Worksheet
Dim newWks As Worksheet
Set wks = ThisWorkbook.Worksheets("sheet1")
wks.Copy 'to a new workbook
Set newWks = ActiveSheet
With newWks
With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With
.Parent.SaveAs Filename:=ThisWorkbook.Path & "\mycsvfilenamehere.csv", _
FileFormat:=xlCSV
.Parent.Close savechanges:=False
With Application
.DisplayAlerts = True
.ScreenUpdating = True
End With
End With
End Sub
Adjust the worksheet name accordingly and the .csv file, too.
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
"border21 <" wrote:
Hi evreone, I have a Excel document and I wish to do the following :
I want to make a macro that automatically saves a copy of the XLS
document in CSV format and updates the CSV document whenever the XLS
one is saved.
The only problem is that I am a total n00b at Excel VBA programming...
Can anyone help me out and point me toward the right direction ??
THX !
---
Message posted from http://www.ExcelForum.com/
--
Dave Peterson