Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to extract file name for use in a cell?

Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to extract file name for use in a cell?

Use the cell function

=cell("filename",A1) where A1 is any cell in the workbook associated with
the name yu are looking for.

" wrote:

Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default How to extract file name for use in a cell?

if you are doing it with code

Set bk = Activeworkbook
s = left(bk.Name,Instr(1,bk.name,".",vbTextcompare)-1)

--
Regards,
Tom Ogilvy


" wrote:

Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm


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
Extract file name Steven Excel Worksheet Functions 8 August 9th 08 09:20 AM
How to extract file extensions? DK Excel Programming 5 December 1st 06 12:15 AM
Extract from a file kkjensen Excel Discussion (Misc queries) 1 June 29th 06 08:55 PM
How to extract value from a different file? Firenzeitl Excel Worksheet Functions 1 April 22nd 06 07:16 AM
Function required to extract cell info from an unopened file. westcountrytractorboy Excel Worksheet Functions 4 February 10th 05 07:57 AM


All times are GMT +1. The time now is 11:14 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"