Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
checking the content of a cell if it starts with certain character Timur Excel Programming 2 August 1st 07 01:26 PM
Checking a String's last character Ren Excel Programming 6 August 2nd 06 06:04 PM
Checking to see whether a string contains a certain character ajitpalsingh200[_21_] Excel Programming 1 November 26th 04 09:36 AM
After checking control checkbox returning focus to the sheet Don Wiss Excel Programming 4 May 12th 04 11:43 AM
Checking the last character is in a list [email protected] Excel Programming 2 August 18th 03 11:37 AM


All times are GMT +1. The time now is 06:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"