vba get workbook by name code example
Example 1: vba get workbook name from range
myRange.Worksheet.Parent.name
Example 2: vba get workbook name
fileName = ThisWorkbook.Name
Debug.Print fileName ' With extension
If InStr(fileName, ".") > 0 Then
fileName = Left(fileName, InStr(fileName, ".") - 1)
Debug.Print fileName ' Without extension
End If