Open Common named excel files from 2 different folders

Ashwini.A

New Member
Joined
Aug 24, 2011
Messages
5
Hello,

I am trying to open the excel files from 2 different folders. Folder1 contains standard templates and Folder2 contains input files. Folder2 may has more than one files matching with same names.
please somebody help me to get this through VBA code.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

This code is to open "xls" file..If u want other format like "xlt" you have change the text(from "xls" to "xlt") Check this. If you any error let me know.:cool:

myLabel:
Filename = Application.GetOpenFilename("All files (*.xls*),*.xls*")
If Filename = False Then
Exit Sub
End If
Set Wbk_St = Workbooks.Open(Filename)
 
Upvote 0
Thanks for the reply Manohar.
It does works fine. But i want to open the files automatically without any prompt/user browse window.
I've an array of files like;
file(1) = "Test1"
file(2) = "Test2" upto 15.
Here Test1 is present in 2 different folders. i want to all files "Filename = Test1" from both the folders. <here i'll do some other manipulations> then close all and go for Test2 files.

Thanks in advance.
 
Upvote 0
Hi,

Let you know what i'm understand,

1. You have 15 files in folder 2. & 1st file will be present in both the folders. ---> this is right..?
2. you have to access all 15 files at a time without using Dialog box & finally u have to close all the 15 files except second file(u have to open 2nd file) ---> this is what u r sayin..?
3. then i have 1 question what will be the name of each file...?
 
Upvote 0
1. I have 15 files in folder1. Filenames are like AP01,AP02,AR02,APCRC04,AR01,AO04 and so on...

Folder2 contains more than 15 files. here also filemanes macthes with files in Folder1. like 20110601_AP02.xls, 20110607_AP01.xls, 2011_06_01_AP02.xls

see here we have totally 3 "AP02" files in both folder1 and folder2. i want all those 3 to be opened.

Then loop for "AP01" files and then to "APCRC04" files....

hope i made u clear.
 
Upvote 0
Hi,

Almost i'm clear about that..

1. U have 2 folders.. each folder contains 15 files or more than that..
If the file (AP01) in folder 1 then match the same file (AP01) in folder 2 also (like 20110601_AP01).If the file matches in folder 1 & in folder 2 then open 2 files . if it is more than 4 or 5 files matches it should be open all the 4 or 5 files..
2. Once the file (AP01) process to be done it next go for other file (AP02).


I think this is right...??? or any changes in this..?:confused:
 
Upvote 0
Yes :)
Thats Correct.. After the process in AP02 is done, close all AP02 files and open other matching files...
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,548
Members
452,927
Latest member
rows and columns

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