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 Parse Directory Filenames


Hello all,


I am stuck and was hoping some of the experts out there in the foru
could give me a hand.

First, let me explain what I am trying to accomplish:


I have a directory (C:\Home) that has hundreds of files in it.

They are medical transcription files in Word format and are named a
such:


12345,Doe John,Ltr.doc

67890,Doe Jane,Pro.doc


The first string of 5 characters is the medical record.
The second string is the patient name.
The third is what type of document this is (Ltr being Letter, Pro bein
Progress Note, etc)


What I am trying to do is:

1. Parse directory and populate A1 with result.
2. Parse filenames, put medical record number in B1
3. Parse filenames, put patient name in C1
4. Parse filenames, put document type in D1

- If Ltr is found, "Letter" is inserted into D1
- If Pro is found, "Progress Note" is inserted into D1


Below is my code, I have gotten as far as 1. in the list above.

Any help would be very much appreciated!


Sub PARSE()
Dim fs, f, f1, f2
Range("A1").Select
i = 1
fldr = "C:\home\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.getfolder(fldr)
Set f1 = f.Files
For Each f2 In f1
ActiveCell.Offset(i, 0).Value = f2.Name
i = i + 1

Next
End Sub





thank you,

Chri

--
chrisjnorsko
-----------------------------------------------------------------------
chrisjnorskov's Profile: http://www.excelforum.com/member.php...fo&userid=2628
View this thread: http://www.excelforum.com/showthread.php?threadid=39570

 
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
Can you pull filenames from a directory? pokdbz Excel Discussion (Misc queries) 1 August 2nd 07 02:54 PM
retrieve filenames from given directory into excel [email protected] Excel Worksheet Functions 11 June 6th 06 06:16 PM
open in old directory save in new directory tim64[_2_] Excel Programming 0 June 15th 05 07:48 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 06:22 AM.

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

About Us

"It's about Microsoft Excel"