Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default Macro to Find File in Subfolders and Open it

Hi all, I am using excel 2007. In Folder "C:\My Document\Record" I
have many Subfolders and in all those subfolders I have many excel
(xlsx) files. All the files names are like the given example below

523360.xlsx
563361.xlsx
658897.xlsx
……etc

I want macro on a button and I want that when I put file name in cell
A1 (for example like 523360) then macro should check that file in
Folder "C:\My Document\Record" and also in all the subfolders of this
Folder and when macro find that file then it should open it. But if
macro dont find that file at all then it should pop up MsgBox that
"File not Found". Please can any friend can help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Macro to Find File in Subfolders and Open it

Maybe something here will give you some ideas:
http://www.rondebruin.nl/tips.htm

Search for the files named 'Merge data from all workbooks in a folder...'
There are at least three that may be of interest to you...

Regards,
Ryan---

--
RyGuy


"K" wrote:

Hi all, I am using excel 2007. In Folder "C:\My Document\Record" I
have many Subfolders and in all those subfolders I have many excel
(xlsx) files. All the files names are like the given example below

523360.xlsx
563361.xlsx
658897.xlsx
€¦€¦etc

I want macro on a button and I want that when I put file name in cell
A1 (for example like 523360) then macro should check that file in
Folder "C:\My Document\Record" and also in all the subfolders of this
Folder and when macro find that file then it should open it. But if
macro dont find that file at all then it should pop up MsgBox that
"File not Found". Please can any friend can help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Macro to Find File in Subfolders and Open it

For the OP

See the code here
http://www.rondebruin.nl/fso.htm

And you can change ExtStr to ExtStr:="523360.xlsx
Or reference a cell value

myCountOfFiles = Get_File_Names( _
MyPath:="C:\Users\Ron\test", _
Subfolders:=True, _
ExtStr:="*.xl*", _
myReturnedFiles:=myFiles)



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"ryguy7272" wrote in message ...
Maybe something here will give you some ideas:
http://www.rondebruin.nl/tips.htm

Search for the files named 'Merge data from all workbooks in a folder...'
There are at least three that may be of interest to you...

Regards,
Ryan---

--
RyGuy


"K" wrote:

Hi all, I am using excel 2007. In Folder "C:\My Document\Record" I
have many Subfolders and in all those subfolders I have many excel
(xlsx) files. All the files names are like the given example below

523360.xlsx
563361.xlsx
658897.xlsx
€¦€¦etc

I want macro on a button and I want that when I put file name in cell
A1 (for example like 523360) then macro should check that file in
Folder "C:\My Document\Record" and also in all the subfolders of this
Folder and when macro find that file then it should open it. But if
macro dont find that file at all then it should pop up MsgBox that
"File not Found". Please can any friend can help


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open all files in subfolders linglc Excel Programming 4 August 19th 06 10:33 AM
Open workbook macro- find correct month to open? buzzharley[_10_] Excel Programming 8 July 8th 06 04:30 AM
file search in subfolders Pflugs Excel Programming 2 September 16th 05 05:00 AM
How to find specific subfolders Rafael Guerreiro Osorio Excel Programming 3 August 11th 05 07:15 PM
How do I find a file/spreadsheet that Excel says is Already open but I can't find it? nwtrader8 Excel Discussion (Misc queries) 5 June 21st 05 02:16 PM


All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"