Hi,
I have a code that I have used previously to open all .xls files in a network folder.
However, it does not work now as it always attempts to open only 2 files - "Codes.xlsx" and "Consolidated.xlsx" - which are files that do not exist on my computer nor anywhere in my code. For e.g. it will attempt to open "//abc/bde/Codes.xlsx" and it will then crash because excel cannot find such a file.
Please kindly advice - the VBA code is pasted below.
Thank you!
Sub Update_c_to_fnc()
Dim oWbk As Workbook
Dim sFil As String
Dim sPath As String
Application.ScreenUpdating = False
sPath = Range("folderpath") 'location of files - defined in sheet as "//abc/bde/"
ChDir (sPath)
sFil = Dir("") 'change or add formats
Do While sFil <> ""
Set oWbk = Workbooks.Open(sPath & "\" & sFil) 'opens the file
sFil = Dir
Loop ' End of LOOP
ThisWorkbook.Activate
Worksheets("Cover").Select
Application.ScreenUpdating = True
End Sub
Bookmarks