Hello all,
Excel 2013 & Word 2013.
I have a directory full of .doc files. Let's call it C:\BOM.
I will generate a .txt file of certain files from that directory and save it as C:\BOM\BOM.txt.
Example: BOM.txt
I need an Excel VBA code that will do the following:
Open an already created excel file, named C:\BOM\Book1.xlsm.
Open file01.doc, Select All, and Copy.
Select the open excel file C:\BOM\Book1.xlsm.
Create a sheet called "file01".
Select A1 on sheet "file01" and Paste.
Close file01.doc.
Open (the next file in BOM.txt) file05.doc, Select All, and Copy.
Select the already open C:\BOM\Book1.xlsm.
Create a sheet called "file05".
Select A1 on sheet "file05" and Paste.
Close file05.doc.
I would like to continue to do this for all the files listed in BOM.txt, and then:
Save Book1.xlsm.
Close Book1.xlsm.
I don't code, so I don't know if this is the logical way to do this. For example, if it needed to create all the sheets first and then copy and paste, that would be fine. At the end of the day, I just need a workbook, multiple sheets that are named after the files in that list, and populated with the data that was selected and copied.
Thanks in advance for your help and consideration. If someone can help, I may be able to see my family some time this month!
Excel 2013 & Word 2013.
I have a directory full of .doc files. Let's call it C:\BOM.
I will generate a .txt file of certain files from that directory and save it as C:\BOM\BOM.txt.
Example: BOM.txt
C:\BOM\file01.doc
C:\BOM\file05.doc
C:\BOM\file11.doc
C:\BOM\file47.doc
C:\BOM\file05.doc
C:\BOM\file11.doc
C:\BOM\file47.doc
I need an Excel VBA code that will do the following:
Open an already created excel file, named C:\BOM\Book1.xlsm.
Open file01.doc, Select All, and Copy.
Select the open excel file C:\BOM\Book1.xlsm.
Create a sheet called "file01".
Select A1 on sheet "file01" and Paste.
Close file01.doc.
Open (the next file in BOM.txt) file05.doc, Select All, and Copy.
Select the already open C:\BOM\Book1.xlsm.
Create a sheet called "file05".
Select A1 on sheet "file05" and Paste.
Close file05.doc.
I would like to continue to do this for all the files listed in BOM.txt, and then:
Save Book1.xlsm.
Close Book1.xlsm.
I don't code, so I don't know if this is the logical way to do this. For example, if it needed to create all the sheets first and then copy and paste, that would be fine. At the end of the day, I just need a workbook, multiple sheets that are named after the files in that list, and populated with the data that was selected and copied.
Thanks in advance for your help and consideration. If someone can help, I may be able to see my family some time this month!