Mid function
try the following:-
strWkBKName = ThisWorkbook.Name
strResult = Mid(strWkBKName, InStr(1, strWkBKName, "_") + 1,
Len(strWkBKName) - 4 - InStr(1, strWkBKName, "_"))
"Ixtreme" wrote in message
...
Hi,
In vba I want to get a part of the workbooks' name in a string.
Each workbook has a name like this
test_XX_YYY.xls
or only test_XX.xls
I want everything before .xls and after the first underscore sign. For
the above filenames I would like to have:
XX_YYY
and
XX
|