Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 147
Default Inserting File name and path in Excel 2007 Documents

We are trying to figure out how to insert the file name and path in Excel
2007. We are also looking for the same in Word 2007. Is it possible to
create a macro or shortcut for this that we can place in the quick access bar?
--
Christine
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Inserting File name and path in Excel 2007 Documents

You can use the following function called from a worksheet cell, to return
either the filename only (e.g., "SomeFile.xls") or the fully qualified file
name (e.g., "C:\SomePath\SomeFolder\SomeFile.xls").

Function FileName(Optional ShortName As Boolean = False) As String
With Application.Caller.Parent.Parent
FileName = IIf(ShortName, .Name, .FullName)
End With
End Function

You would then call this with

=FileName(TRUE) ' file name only
or either of
=FileName(FALSE) ' full file name
=FileName() ' full file name


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

"Christine" wrote in message
...
We are trying to figure out how to insert the file name and path in Excel
2007. We are also looking for the same in Word 2007. Is it possible to
create a macro or shortcut for this that we can place in the quick access
bar?
--
Christine


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Inserting File name and path in Excel 2007 Documents

Insert the filename and path where?

In a header or footer?

I don't use 2007 but 2002 and 2003 versions had a path and filename icon in
Custom Footers and Headers under print setup.

I can't believe Excel 2007 wouldn't have the same feature.

Macro if you want one.

Sub PathInFooter()
ActiveSheet.PageSetup.RightFooter = ActiveWorkbook.FullName & " " & _
ActiveSheet.Name & " " & Application.UserName & " " & Date
End Sub


Gord Dibben MS Excel MVP


On Tue, 15 Jan 2008 15:46:02 -0800, Christine
wrote:

We are trying to figure out how to insert the file name and path in Excel
2007. We are also looking for the same in Word 2007. Is it possible to
create a macro or shortcut for this that we can place in the quick access bar?


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
User wants to see full path in recent documents Excel 2007 wadeyk Excel Discussion (Misc queries) 4 October 25th 07 11:08 PM
How can I automatically print file path on documents Brenda @ FCA Excel Discussion (Misc queries) 6 May 17th 07 02:55 PM
Excel 2007 add-in with file path showing Razzer204 Excel Discussion (Misc queries) 3 March 21st 07 04:24 PM
Inserting File Path name Kelli Excel Discussion (Misc queries) 1 February 13th 07 09:04 PM
Inserting Field To Insert Full Path to Excel File Will Excel Discussion (Misc queries) 3 February 11th 06 09:59 AM


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

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"