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: 41
Default Help with a macro to display documents

I have the code listed below that searches a folder and if it finds
any
PDF files its displays them with a hyperlink in the spreadsheet. My
problem is that under the MAIN folder I have tons of files now and
its
very hard to find the PDF I am looking for.

I redid my file structure under main and now I have folders for years
2010,
2012,2013,2014,2015 and so on. Under each years directory are the
directories for the 12 months of the year & under each of these
months
I have two folders A-cast & B-cast.

What I would like is that the code could search the folders starting
form MAIN by prompting the user for the year, & than the month & then
the folder name And then display contents of the folder as results
on the spreadsheet If a user did not have lets say the folder names A-
cast & B-cast the
program could display contents of both A-cast & B-cast.

Here is the code I got from the forum.

Sub all_2010()
' Macro to searh & display PDf files
Dim i As Long
With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.Filename = "*.pdf"
.LookIn = "c:\Scans\TW\MAIN"
.Execute
For i = 1 To .FoundFiles.Count
ActiveSheet.Hyperlinks.Add Anchor:=Range("A" & i), _
Address:=.FoundFiles(i), TextToDisplay:= _
Right(.FoundFiles(i), Len(.FoundFiles(i)) - _
InStrRev(.FoundFiles(i), "\"))
Next
End With
End Sub


Thanks in advance
 
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
Recent documents don't display danappofc Excel Discussion (Misc queries) 2 April 17th 10 07:36 PM
Display recent documents feature in Excel Tabs man Excel Worksheet Functions 1 March 2nd 10 08:29 PM
When opening older version documents they do not display correctly Melissa Rose Excel Discussion (Misc queries) 0 February 27th 09 02:00 PM
Excel documents do not display when opened Justin G. Mitchell Excel Discussion (Misc queries) 1 September 18th 07 01:20 PM
Excel workbook fails to display when selecting from my documents. 4jjgolly Excel Worksheet Functions 1 March 9th 05 12:48 AM


All times are GMT +1. The time now is 03:52 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"