PDA

View Full Version : VBA script to monitor folder and change file to csv



Domagoj2133
01-16-2024, 11:36 AM
Dear VBA,


I need help with my coding, I need to create VBA script which will monitor one folder and convert excel sheet that is exel file (ID, Status, Name, Surname) to csv file (ID, Status) and move it to a new folder and delete excel from input folder. Thank You very much.


Best regards.
D

jdelano
01-16-2024, 12:02 PM
You should always create a new post instead of reviving an old one. Especially given this is different from the original question.

In my opinion, this is something that VBA isn't suited for. You really don't want a Microsoft Office app running all the time to just monitor a folder. Using VB6 or VB.Net w/Winform or better just a Windows service would be better.

Perhaps Monitor Folder for changes-VBForums (https://www.vbforums.com/showthread.php?98183-Monitor-Folder-for-changes)

Aussiebear
01-16-2024, 01:05 PM
Welcome to VBAX Domagoj2133. As suggested by jdelano, this thread of yours should be an independent thread, so I've corrected this for you.

Aussiebear
01-16-2024, 02:23 PM
If I understand your post, you would like to;
a) Monitor a particular folder, for any excel files, (these workbooks contain 4 columns of data - ID, Status, Name & Surname, then
b) Open each workbook, copy two columns namely ID & Status, save the copied range to a new file in different folder as a csv format, then
c) Delete the original excel file.

Is this correct?

A couple of quick questions. Do you know, for example;
The path and file name of the folder that currently holds the excel files, and the path of the intended folder that you wish to save the new files into?
Is there any way to define which excel workbooks, which actual sheet contains the actual data, and which actual columns contain the data?

Have you tried to do this process using the macro recorder?