This should give you something to start with: Option Explicit Sub OpenFiles() Dim fso, fl, fc, f Dim PathFldr Dim msg Set fso = CreateObject("Scripting.FileSystemObject") PathFldr = "C:\temp" msg = "Selected:" If (fso.folderexists(PathFldr)) Then If (Right(PathFldr, 1) <> "\") Then PathFldr = PathFldr & "\" Set fl = fso.getfolder(PathFldr) 'gets Folder object Set fc = fl.Files 'Creates Files "Collection" For Each f In fc 'Loops through each file in the "Collection" If (UCase(Left(f.Name, 7)) = "EXTRACT") Then msg = msg & Chr(13) & f.Name Workbooks.Open Filename:=PathFldr & f.Name End If Next MsgBox msg End If End Sub
Paul ________________________________ From: Sunny Kapoor <sunnykapo...@gmail.com> To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com> Sent: Thu, June 3, 2010 8:34:10 AM Subject: $$Excel-Macros$$ Help in Excel-macro to open files whose name start with "Extract" I need to make a macro to open files whose name start with Extract...the Folder has about 15 files and about 10 files begin with "extract". I think i need a loop to do it but dont know how to do it.....plz 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 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 <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 7000 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -- ---------------------------------------------------------------------------------- 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 <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 7000 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe