I currently have this code to check if a workbook is open before proceeding to run the rest of the code. This works great when looking at the whole workbook name. How can this be modified to just look at the beginning
of the workbook name minus the date (Current Hilliard WIP)? Any help would be appreciated. Thank You
of the workbook name minus the date (Current Hilliard WIP)? Any help would be appreciated. Thank You
VBA Code:
Function IsWorkBookOpen(Name As String) As Boolean
Dim xWb As Workbook
On Error Resume Next
Set xWb = Application.Workbooks.Item(Name)
IsWorkBookOpen = (Not xWb Is Nothing)
End Function
Code:
Dim xRet As Boolean
xRet = IsWorkBookOpen("Current Hilliard WIP-01142023.xlsm")
If xRet Then
MsgBox "Found it, Current Hilliard WIP Is Open, Ok To Continue", vbInformation
End If