ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   UDF Help. (https://www.excelbanter.com/excel-programming/304947-udf-help.html)

Yppes

UDF Help.
 
Please help a newbie.

Could anyone, kindly, show me how I can program a UDF to
make a content of a cell, return "the last time the spread
sheet was saved". This cell in question is part of the
same spread sheet.

I'm running Excel 97.

The save function can be (both) when the file is still open
or right before it's closed. The content of a cell should
reflect (in date format) when the sheet is saved.

Thanks in advance.

Yppes

Stan Scott

UDF Help.
 
Yppes,

This function does the trick:

Function getLastSaved()
Dim FSO
Dim f
Set FSO = CreateObject("Scripting.FileSystemObject")
Set f = FSO.GetFile(ActiveWorkbook.FullName)
getLastSaved = f.DateLastModified
Set FSO = Nothing
Set f = Nothing
End Function

This returns a string in date/time format, such as "7/24/2004 5:05:32 PM".
You can take it from there.

Stan Scott
New York City

"Yppes" wrote in message
...
Please help a newbie.

Could anyone, kindly, show me how I can program a UDF to
make a content of a cell, return "the last time the spread
sheet was saved". This cell in question is part of the
same spread sheet.

I'm running Excel 97.

The save function can be (both) when the file is still open
or right before it's closed. The content of a cell should
reflect (in date format) when the sheet is saved.

Thanks in advance.

Yppes




Bob Phillips[_6_]

UDF Help.
 

Function LastSaved()
LastSaved = ActiveWorkbook. _
BuiltinDocumentProperties("Last Save Time")
End Function

make sure that you format the target cell.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Yppes" wrote in message
...
Please help a newbie.

Could anyone, kindly, show me how I can program a UDF to
make a content of a cell, return "the last time the spread
sheet was saved". This cell in question is part of the
same spread sheet.

I'm running Excel 97.

The save function can be (both) when the file is still open
or right before it's closed. The content of a cell should
reflect (in date format) when the sheet is saved.

Thanks in advance.

Yppes




Tom Ogilvy

UDF Help.
 
Just some additional information:
using built in document properties
Excel 97 doesn't maintain the builtin document propert Last Save Time

using FSO to look at file properties
When a file is opened, its DateLastModified is set to the time it was
opened. If you subsequently save it in that session, then that function
might work.

--
Regards,
Tom Ogilvy

"Yppes" wrote in message
...
Please help a newbie.

Could anyone, kindly, show me how I can program a UDF to
make a content of a cell, return "the last time the spread
sheet was saved". This cell in question is part of the
same spread sheet.

I'm running Excel 97.

The save function can be (both) when the file is still open
or right before it's closed. The content of a cell should
reflect (in date format) when the sheet is saved.

Thanks in advance.

Yppes





All times are GMT +1. The time now is 10:00 AM.

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