Thread: Mid function
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Mid function

On Thu, 1 Oct 2009 05:45:54 -0700 (PDT), Ixtreme wrote:

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



In VBA:

Mid(ThisWorkbook.Name, InStr(ThisWorkbook.Name, "_") + 1)


--ron