ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filename Function (https://www.excelbanter.com/excel-programming/311955-filename-function.html)

Steph[_3_]

Filename Function
 
Function FName()
FName = ActiveWorkbook.Name
End Function

This returns the filename.xls. Can I add a left function to this to remove
the .xls? I can do it within a cell, but not sure how to edit the function
to do it. Thanks!



Norman Jones

Filename Function
 
Hi Steph,

Dim fname As String
fname = ActiveWorkbook.Name
fname = Left(fname, Len(fname) - 4)
MsgBox fname


---
Regards,
Norman



"Steph" wrote in message
...
Function FName()
FName = ActiveWorkbook.Name
End Function

This returns the filename.xls. Can I add a left function to this to
remove
the .xls? I can do it within a cell, but not sure how to edit the
function
to do it. Thanks!





Steph[_3_]

Filename Function
 
Thank you!

"Norman Jones" wrote in message
...
Hi Steph,

Dim fname As String
fname = ActiveWorkbook.Name
fname = Left(fname, Len(fname) - 4)
MsgBox fname


---
Regards,
Norman



"Steph" wrote in message
...
Function FName()
FName = ActiveWorkbook.Name
End Function

This returns the filename.xls. Can I add a left function to this to
remove
the .xls? I can do it within a cell, but not sure how to edit the
function
to do it. Thanks!








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com