NessPJ
Active Member
- Joined
- May 10, 2011
- Messages
- 431
- Office Version
- 365
Hi all,
I am actually looking for a way to invoke a few file operations when working in Excel (Using VBA or so). Yet, i want the criteria for the files to be user customisable (the filename differs).
(1) In detail, i have a folder with report files from a WMS/PWS server.
This folder contains a file for each day of the month (where the file number equals the day number).
For instance... pws.stats.1.csv, pws.stats.2.csv, pws.stats.3.csv etc.
(2) Now i already have a little VBA code that opens up 2 explorer windows, 1 for the folder with the reports and one window that contains 7 folders for the user to drag the right reports in (Day 1 through Day 7).
(3) As a next step i have a shell commandline which renames all the files in the folder (it removes the .csv extension because if not, the files will not be imported correctly.
And then the final step is a Macro that imports the files into Excel (right format and right sheet of the workbook).
Step 2 is the one i actually want to automate, by giving the user the ability to input the number of the filename (which equal a day number) into 7 cells. When these are inserted i want a piece of VBA code to use those numbers as a variable to copy the right files into the according 7 folders (pws.stat.&number1&.csv, pws.stat.&number2&.csv).
When searching online i found this piece of code:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=827
Yet this was a little too much for me to comprehend (i'm no expert at VBA).
If anyone here could lent me a hand that would be awesome.
I'm guessing i need a piece of code that allows me to define 7 variables which then can be used to copy (and hopefully rename) these files.
Thanks in advance for your time.
I am actually looking for a way to invoke a few file operations when working in Excel (Using VBA or so). Yet, i want the criteria for the files to be user customisable (the filename differs).
(1) In detail, i have a folder with report files from a WMS/PWS server.
This folder contains a file for each day of the month (where the file number equals the day number).
For instance... pws.stats.1.csv, pws.stats.2.csv, pws.stats.3.csv etc.
(2) Now i already have a little VBA code that opens up 2 explorer windows, 1 for the folder with the reports and one window that contains 7 folders for the user to drag the right reports in (Day 1 through Day 7).
(3) As a next step i have a shell commandline which renames all the files in the folder (it removes the .csv extension because if not, the files will not be imported correctly.
And then the final step is a Macro that imports the files into Excel (right format and right sheet of the workbook).
Step 2 is the one i actually want to automate, by giving the user the ability to input the number of the filename (which equal a day number) into 7 cells. When these are inserted i want a piece of VBA code to use those numbers as a variable to copy the right files into the according 7 folders (pws.stat.&number1&.csv, pws.stat.&number2&.csv).
When searching online i found this piece of code:
http://www.vbaexpress.com/kb/getarticle.php?kb_id=827
Yet this was a little too much for me to comprehend (i'm no expert at VBA).
If anyone here could lent me a hand that would be awesome.
I'm guessing i need a piece of code that allows me to define 7 variables which then can be used to copy (and hopefully rename) these files.
Thanks in advance for your time.
Last edited: