At the risk of sounding like a rookie, which I am in regards to VBA, where within what I have would this need to be placed in order for it to proccess the proper file. Also, you stated that I need to have the full paths as in your example. The files do not always have a suffix on them. If I write the code before it goes to the shop, then it would have a .out on the end. If it is a file that the operator saved from his machine, then it would be blank.
Thanks John On Sep 19, 7:31 pm, ashish koul <koul.ash...@gmail.com> wrote: > Hi John > > Try this one > > you need to have full paths in column f Like below > > C:\Documents and Settings\achamanlalko\My Documents\Downloads\3004.OUT.txt > C:\Documents and Settings\achamanlalko\My Documents\Downloads\7110.txt > > Sub importnotepaddata() > Dim i, j As Long > Dim s As String > Set objFSO = CreateObject("Scripting.FileSystemObject") > For j = 5 To Sheets(1).Range("a65356").End(xlUp).Row > i = 1 > Set objFile = objFSO.OpenTextFile(Sheets(1).Range("f" & j).Text, 1) > Do Until objFile.AtEndOfStream > strLine = objFile.ReadLine > If strLine <> "" Then > i = i + 1 > Cells(j, 7).Value = strLine > If i = 3 Then > s = "" > s = Cells(j, 7).Value > Cells(j, 8).Value = Left(Right(s, Len(s) - InStr(s, "(")), Len(Right(s, > Len(s) - InStr(s, "("))) - 1) > Cells(j, 7).Value = Left(s, InStr(s, "(") - 1) > Exit Do > End If > End If > Loop > objFile.Close > Next j > Set objFSO = Nothing > End Sub > > Regards > Ashish koul > > 2011/9/19 johnofeasttex <j...@demco-mfg.com> > > > > > > > OK > > The file Book3 has the macro I used to pull in the file list information. > > It allso contains on the sheet what I am looking for in the way of output. > > The file F8030Directory shows what the output currently looks like from a > > particular directory that contains the files I need. The 2 additional > > columns on the Book3 sheet shows the information I want to retrieve from > > inside the file. The 2 files 3004.out and 7110. are examples of the files it > > would encounter. > > Thanks in advance for your help. > > > -- > > > ---------------------------------------------------------------------------------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > >http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below link > >http://www.facebook.com/discussexcel > > -- > *Regards* > * * > *Ashish Koul* > *http://www.excelvbamacros.com/* > > P Before printing, think about the environment.- Hide quoted text - > > - Show quoted text - -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel