Hi
Does anyone know a code to Open the next workbook in a folder without knowing name of the workbook?:(:(
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!
Hi
Does anyone know a code to Open the next workbook in a folder without knowing name of the workbook?:(:(
Hi Hugh and welcome,
This code will return the workbooks in a folder.
Note that the workbooks will not be returned in any particular order. So if order is important you will have to get all the names and the sort the array.
Sub ATest()
Dim strName As String
strName = GetNextWorkbookName(ThisWorkbook.Path & "*.xls")
Do
Debug.Print strName
strName = GetNextWorkbookName()
Loop While strName <> ""
ShowFileList ThisWorkbook.Path
End Sub
Function GetNextWorkbookName(Optional Name As String) As String
If Name <> "" Then
GetNextWorkbookName = Dir(Name)
Else
GetNextWorkbookName = Dir()
End If
End Function
Display More
Cheers
Andy
Don’t have an account yet? Register yourself now and be a part of our community!