Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning a file name after checking for specific character
Hi,
I need to return the first set of characters before an underscore in a filename. slightly disappointed as I can't do this: FName = Chr$(34) & Left(ActiveWorkbook.Name, Search(Chr$(95), ActiveWorkbook.Name)) & Chr$(34) How else can I do it, apart from using another workbook cells to return the activeworkbookName and then using the len and search function....this is part of a loop of many workbooks. Many thanks Wendy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning a file name after checking for specific character
Weny,
Use the Instr function FName = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, "_") - 1) Mike "Wendy" wrote: Hi, I need to return the first set of characters before an underscore in a filename. slightly disappointed as I can't do this: FName = Chr$(34) & Left(ActiveWorkbook.Name, Search(Chr$(95), ActiveWorkbook.Name)) & Chr$(34) How else can I do it, apart from using another workbook cells to return the activeworkbookName and then using the len and search function....this is part of a loop of many workbooks. Many thanks Wendy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning a file name after checking for specific character
Try
FName = Left$(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, Chr $(95)) - 1) HTH On Nov 1, 8:58*pm, Wendy wrote: Hi, I need to return the first set of characters before an underscore in a filename. slightly disappointed as I can't do this: FName = Chr$(34) & Left(ActiveWorkbook.Name, Search(Chr$(95), ActiveWorkbook.Name)) & Chr$(34) How else can I do it, apart from using another workbook cells to return the activeworkbookName and then using the len and search function....this is part of a loop of many workbooks. Many thanks Wendy |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning a file name after checking for specific character
Thanks Mike, forgot about InStr...
Cheers Wendy "Mike H" wrote: Weny, Use the Instr function FName = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, "_") - 1) Mike "Wendy" wrote: Hi, I need to return the first set of characters before an underscore in a filename. slightly disappointed as I can't do this: FName = Chr$(34) & Left(ActiveWorkbook.Name, Search(Chr$(95), ActiveWorkbook.Name)) & Chr$(34) How else can I do it, apart from using another workbook cells to return the activeworkbookName and then using the len and search function....this is part of a loop of many workbooks. Many thanks Wendy |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Returning a file name after checking for specific character
Glad I could help
"Wendy" wrote: Thanks Mike, forgot about InStr... Cheers Wendy "Mike H" wrote: Weny, Use the Instr function FName = Left(ActiveWorkbook.Name, InStr(ActiveWorkbook.Name, "_") - 1) Mike "Wendy" wrote: Hi, I need to return the first set of characters before an underscore in a filename. slightly disappointed as I can't do this: FName = Chr$(34) & Left(ActiveWorkbook.Name, Search(Chr$(95), ActiveWorkbook.Name)) & Chr$(34) How else can I do it, apart from using another workbook cells to return the activeworkbookName and then using the len and search function....this is part of a loop of many workbooks. Many thanks Wendy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
checking the content of a cell if it starts with certain character | Excel Programming | |||
Checking a String's last character | Excel Programming | |||
Checking to see whether a string contains a certain character | Excel Programming | |||
After checking control checkbox returning focus to the sheet | Excel Programming | |||
Checking the last character is in a list | Excel Programming |