Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
XLS to CSV conversion
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 XL document in CSV format and updates the CSV document whenever the XL 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
XLS to CSV conversion
|
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
XLS to CSV conversion
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conversion to value between 1 to 10 only! | New Users to Excel | |||
ESN conversion | Excel Worksheet Functions | |||
pdf conversion | Excel Worksheet Functions | |||
Between conversion | Excel Worksheet Functions | |||
hex conversion | Excel Programming |