Get file details

ChrisUK

Well-known Member
Joined
Sep 3, 2002
Messages
675
Hi,

I wonder if someone can see what I'm doing wrong here

What I thought was a very simple function. In a worksheet cells I have the file name - GetFileDetails("u:\documents\stuff.txt"). I know the file exists but but I always get an error, when I debug it the error is file not found.

Thanks in anticipation

Chris
Code:
Function GetFileDetails(fn As String) As String
'
On Error GoTo ErrHandler

GetFileDetails = FileDateTime("fn")
GoTo EndFunc

ErrHandler:
GetFileDetails = "File Not Found"

EndFunc:

End Function
 
Last edited by a moderator:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
It should be:
Code:
GetFileDetails = FileDateTime(fn)
without the quotes round "fn".
 
Upvote 0
It should be:
Code:
GetFileDetails = FileDateTime(fn)
without the quotes round "fn".

AHHHHHHHHHHHHHHHHHHH I was looking at that for ages! Funny how the obvious things always evade you.

Thanks

Chris
 
Upvote 0

Forum statistics

Threads
1,214,958
Messages
6,122,475
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top