LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code works, but is slow


Hello again,

Here is a code that works fine, however, because of the number of files
it has to scan (or look through) it takes as much as 2 minutes to open
the file it's looking for. Below I provide the code and the path it
takes.

Is there a way to modify this code to look in a certain folder on the
drive to speed up its search process.

CODE:
Sub AGetSheet()
'subroutine to open a filename from a cell, looking in the specified
drive
With Application.FileSearch
..NewSearch
..LookIn = "I:\"
..SearchSubFolders = True
..Filename = Range("P12")
If .Execute 0 Then
Workbooks.Open .FoundFiles(1)
End If
End With
End Sub

PATH:
I:\PLANT\LAB\Lab Tech Stuff\2005 FINISH MILL SHEETS\#4 FINISH MILL
2005

In the cell P12, I have #4 Finish Mill 2005, which excel does find it,
but again its not fast enough; the drive is very large. Can the code
reference excel to look in, say the 2005 FINISH MILL SHEETS (which is
the folder where the file is) to shorten the search?

Sorry so long,
Thanks,
EMoe


--
EMoe
------------------------------------------------------------------------
EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183
View this thread: http://www.excelforum.com/showthread...hreadid=495925

 
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
Code somewhat works. Please help? jsc3489 Excel Programming 4 December 2nd 05 07:51 PM
Why this code works and other do not? Newbie here. [email protected] Excel Programming 2 September 10th 05 01:12 PM
Code works for any WBK except the PMW Mark Tangard[_3_] Excel Programming 3 July 17th 05 11:54 AM
Why won't this code works ksnapp[_37_] Excel Programming 6 April 1st 04 01:44 PM
Code works in XL2000 but not in XP!? Big Chris[_21_] Excel Programming 2 December 13th 03 03:57 PM


All times are GMT +1. The time now is 07:33 PM.

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"