Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi everyone. I have the below code that opens all files within a specific
folder. But if one of the files is already open (very likely to happen) I get an error. Can I add some sort of if stmt that will ignore the file if it is already open, so the code won't error out? Thank you in advance! Steph Dim sFolder As String Dim wb As Workbook Dim i As Long With Application.FileSearch .NewSearch .LookIn = "\\Server\Folder1\Folder2" .SearchSubFolders = False .filename = "*.xls" .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then For i = 1 To .FoundFiles.Count Set wb = Workbooks.Open(filename:=.FoundFiles(i)) Next i Else MsgBox "Folder " & sFolder & " contains no required files" End If End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Open Certain Excel Files in Folder | Excel Discussion (Misc queries) | |||
Open all files in a folder | Excel Programming | |||
Open Excel files in a folder | Excel Programming | |||
How do I get series of files to open from same folder | Excel Programming | |||
open all files in a folder and ... | Excel Programming |