Excel macro to copy file names in desired section of ms word

sankar931990

New Member
Joined
Feb 17, 2018
Messages
1
Hi,
I am having a requirement to transfer some files from one location to another location,let the location be named as 'B'.
Inside 'B', four folders are there , and based on some requirments,the files get placed in anyone of the folder.

For example,let these are the 4 folders in the location 'B',
Folder 1 - Task1-Daily
Folder 2 - Task1-Weekly
Folder 3- Task2-Daily
Folder 4- Task2-Weekly

And the files(mostly excel sheets) who's names starts with Task1-Daily_XXXXXXX.xls are placed in Folder 1,
similarly Task2-Weekly_XXXXXXX.xls are placed in folder 4. These will be similar case for folder 2 and 3.

Once the files are transferred, i need to open a word document, and it contains 4 sections like Task1_Daily files, Task1_Weekly files,Task2_Daily files and Task2_Weekly files.


So finally my requirement is to write a excel macro which does the following two condition:
1.Transfer the files from one place to 'B' location,by reading the file name and placing it in correct folder.
2.Open the MS word,under each section, add the names of the file copied at the last.

for ex,

Task1_Daily Files:
-> Task1_Daily_01XXXX.xls
->Task1_Daily_02XXXXX.xls

Task2_Weekly Files:
->Task2_Weekly_01XXX.xls


This macro should read the name of the file,and if the name is like Task1_Daily_03XXXX.xls,then it should go to 'Task1_Daily Files' section, and append the file name after 'Task1_Daily_02XXXXX.xls' file name.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,223,888
Messages
6,175,215
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top