Workbook name function


Posted by Ken Brading on January 06, 2000 3:48 PM

Is there an excel spreadsheet function that returns the name of the file that you're working in?
Ken Brading

Posted by FrankC on January 09, 2000 6:36 AM

I have spent much time over this one too. In the end
I ended up including a form in the beginning where you/the user
enters the name of the file, and my VBA code takes it from there.




Posted by Ken Brading on January 10, 2000 10:15 AM

Frank,
Thank you for your response. I recently wrote
the following function to handle the problem. It
returns just the name of the workbook without the
.XLS extension.

Private Function File()
'Returns the name of the workbook
File_Name = ActiveWorkbook.Name
StringLength = Len(File_Name)
File = Left(File_Name, StringLength - 4)
End Function

Just place it in a VBA Module.

Regards,
Ken