Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() How can I open all excel workbooks in a folder which starts with "BFR"... Something like this: For each wb in folder("X") if filename = "BFR*" then end if Loop how do I write this correct? Thanks for the help -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=505288 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe
Sub ProcessFiles() Dim FSO As Object Dim i As Long Dim sFolder As String Dim fldr As Object Dim Folder As Object Dim file As Object Dim Files As Object Set FSO = CreateObject("Scripting.FileSystemObject") sFolder = "C:\myTest\myTest" 'sFolder = "c:\my documents\excel\test" If sFolder < "" Then Set Folder = FSO.GetFolder(sFolder) Set Files = Folder.Files For Each file In Files If Left(file.Name,3) = "BFR" Then Workbooks.Open Filename:=file.Path With ActiveWorkbook .SaveAs Left(.FullName, Len(.FullName) - 4), _ FileFormat:=xlTextMac .Close savechanges:=False End With End If Next file End If ' sFolder < "" End Sub -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "Ctech" wrote in message ... How can I open all excel workbooks in a folder which starts with "BFR"... Something like this: For each wb in folder("X") if filename = "BFR*" then end if Loop how do I write this correct? Thanks for the help -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=505288 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Workbook saved in FTP folder | Excel Discussion (Misc queries) | |||
Link with workbook in other folder which is in another group | Excel Discussion (Misc queries) | |||
Last Workbook in A Folder | Excel Programming | |||
for every workbook in folder | Excel Programming | |||
New Folder, Workbook, and Worksheet | Excel Programming |