Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Function to Return File Name of Active Workbook

Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Function to Return File Name of Active Workbook

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fi
lename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Magnivy" wrote in message
...
Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Function to Return File Name of Active Workbook

Sub filename()
MsgBox ("This Workbook's name is " & ThisWorkbook.Name)
End Sub

--
Best wishes,

Jim


"Magnivy" wrote:

Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 324
Default Function to Return File Name of Active Workbook

Sub filename()
MsgBox ("This Workbook's name is " & ThisWorkbook.Name)
End Sub

--
Best wishes,

Jim


"Magnivy" wrote:

Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Function to Return File Name of Active Workbook

Jim, thanks for your reply. I am trying to create a function, insteat of a
macro, so that I would be able to use it inside a worksheet (as I need to use
the name of the file inside other functions). Is there a way to do that?

Thanks,
Magnivy

"Jim Jackson" wrote:

Sub filename()
MsgBox ("This Workbook's name is " & ThisWorkbook.Name)
End Sub

--
Best wishes,

Jim


"Magnivy" wrote:

Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 70
Default Function to Return File Name of Active Workbook

Thanks a lot for your help Bob!

"Bob Phillips" wrote:

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CELL("fi
lename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Magnivy" wrote in message
...
Hello,

I'm trying to create a custom function that would return the file name of
the active workbook (as I dont know a worksheet function that would do so
directly), and am not having much luck. I tried

Function filename()
filename = ActiveWorkbook.Name
End Function

but this returns an error. Any suggestions would be greatly appreciated.

Thank You!

Magnivy





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
Desperately seeking ACTIVE.WORKBOOK function for XLM arcibald tuttle Excel Worksheet Functions 0 February 21st 11 01:25 PM
Get File Size (Number of Bytes) of Active Workbook dflayfield Excel Programming 5 October 11th 05 06:11 PM
Function to return the active sheet name Will Excel Worksheet Functions 2 August 23rd 05 04:33 PM
how can I return the active row and active column? Greg Excel Programming 0 February 3rd 05 07:38 PM
workbook name (? function to return) mark kubicki Excel Programming 1 June 21st 04 06:57 PM


All times are GMT +1. The time now is 09:54 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"