Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export as CSV

Status
Not open for further replies.

smithia6

Technical User
Aug 28, 2002
35
0
0
US
Hi guys I am no VB expert at all so I am in desperate need of help please.

Does anyone have some code I can cut and past for the following:-

I have a excel spreadsheet with 2 worksheets.
I have a button in one of the sheets and what I want to happen is once this button is clicked I want it to activate a sheet called Data Fixes and export out the data inside it to my D: drive in CSV format and have the file name as yesterdays date in the format DD.MM.YYYY.csv however I this will be clicked a few times a day so I would want it to append to the same file and not over write it.

Can anyone help at all??

Cheers

Ian
 
Hi Ian [bigglasses]

Surely you use a function to obtain dd.mm.yyyy of yesterday.
If you use your program several times a day, this function will forcerly gives you the same name of file dd.mm.yyyy.csv

So, when you have this file name, verify if it already exists with the method FileExists(file_name).
If it already exists, go at the end of this file and append your new datas.

Rodie [smarty]

 
Rodie

I understand what your saying if file Exists etc.
My problem is a know zero about VB and I have to add the above function to the excel sheet !!!

Can you help at all?
 
Apparently, your problem is not about Overwriting ... ?

Explain me what is it. I don't really understand.
My problem is a know zero about VB and I have to add the above function to the excel sheet !!!
You want your Macro to be available for differents Workbooks ? is it that ?

Rodie.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top