Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Inserting a filename into a cell

Hi
try one of the following formulas (note: the workbook has to be save
before). Just use the formulas as they are shown (don't replace
'filename' with anything else)

File path and file name:
=CELL("filename",A1)

File path only
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

File name only
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CEL
L("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1) )-FIND("]",CELL("file
name",A1),1))


--
Regards
Frank Kabel
Frankfurt, Germany


davidoo2005 wrote:
How can I obtain the name of a file as a string? For instance, in
workbook C:\Documents and Settings\Me\Folder\file1.xls, I would like
file1 to be the string.


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
Are there any NON-Visual Basic solutions for inserting a picture based a derived or called filename? The Great Attractor Excel Worksheet Functions 7 May 27th 07 04:38 AM
Cell("filename") doesn't update to new filename when do save as. Louis Excel Worksheet Functions 2 March 22nd 07 07:27 PM
substitute the filename in a cell reference with a string in another cell. flummi Excel Discussion (Misc queries) 11 February 22nd 06 01:14 PM
Filename in a cell phica dk Excel Worksheet Functions 3 November 16th 04 04:14 PM
Inserting Date In Filename Using Macro Mega_-__ Excel Programming 2 November 27th 03 08:51 PM


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

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

About Us

"It's about Microsoft Excel"