View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
Dave Dave is offline
external usenet poster
 
Posts: 1,388
Default Check Folder For Files

Thanks Dave,

So far, I have this:

Sub Checks()

Dim myNames As Variant
Dim wkbk As Workbook
Dim myPath As String
Dim iCtr As Long
Set something = Application.FileDialog(msoFileDialogFolderPicker)
MsgBox "Select the SystmOne GMS Files (Originals)", vbInformation
something.Show
somethingpath = CurDir()

myNames = Array("WORKBOOKONE.xls", "WORKBOOKEIGHT.xls", "WORKBOOKNINE.xls")
'you'd type in all 24 of those names

myPath = somethingpath 'or whatever you used to get the path
If Right(myPath, 1) < "\" Then
myPath = myPath & "\"
End If

For iCtr = LBound(myNames) To UBound(myNames)

Set wkbk = Workbooks.Open(Filename:=myPath & myNames(iCtr))

'do stuff with wkbk
wkbk.Close savechanges:=False 'or true??

Next iCtr

End Sub

When a file is found, I guess it skips to the next. However when a file is
not present, it just stops the Macro with an error. I want it to show a
message e.g. "WORKBOOKNINE.xls Not Found" and then once the user clicks ok it
will continue.

Can you (or anyone) please help?

Thanks again!!