If you want just the file name with no path information, use
ActiveWorkbook.Name
' or
ThisWorkbook.Name
If you want the full file name including path information, use
ActiveWorkbook.FullName
' or
ThisWorkbook.FullName
ActiveWorkbook refers to the workbook that is active in Excel,
regardless of which workbook contains the code. ThisWorkbook always
refers to the workbook that contains the code, regardless of what
workbook might be active in Excel.
Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Tue, 9 Dec 2008 05:33:13 -0800 (PST), Fan924
wrote:
Workbook file name. How do I call it up for use in a macro?