workbook name vba code example
Example: 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