Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
SirSimons
 
Posts: n/a
Default Now() - LastSAvedBy??

I need a funktion in my excel sheet, that indicate the person who have saved
a file the last time - Like the NOW() formula, I look for a formula that link
to LastSavedBy
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

'-----------------------------------------------------------------
Function DocProps(prop As String)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocument*Properties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function


and enter in a cell such as
=DocProps ("last author")
or
=DocProps ("last save time")


This will not update when you save within Excel. If you need this, add

Option Explicit

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Application.EnableEvents = False
Cancel = True
ActiveWorkbook.Save
Application.CalculateFull
wb_exit:
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--

HTH

RP
(remove nothere from the email address if mailing direct)


"SirSimons" wrote in message
...
I need a funktion in my excel sheet, that indicate the person who have

saved
a file the last time - Like the NOW() formula, I look for a formula that

link
to LastSavedBy



  #3   Report Post  
FSt1
 
Posts: n/a
Default

hi,
add this to your workbook
Add a sheet then hide it. in the code below, change sheet2 to your hidden
sheet.
any time someone saves the file, this cod will run.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("sheet2").Range("A1") = Now()
Sheets("sheet2").Range("A1").Copy
Sheets("sheet2").Range("A1").PasteSpecial xlPasteValues
Sheets("sheet2").Range("A2").Value = Application.UserName
End Sub

regards
FSt1


"SirSimons" wrote:

I need a funktion in my excel sheet, that indicate the person who have saved
a file the last time - Like the NOW() formula, I look for a formula that link
to LastSavedBy

  #4   Report Post  
SirSimons
 
Posts: n/a
Default

Thank you for your answers.

I dosen't seems to be working. It could be because I'm running a danish
version og Excel. Anyone who knows where to find that the last author is
defined as "last author" I have tried typing the danish word in the
preferences instead but i doesn't work.

Simonsen

"FSt1" skrev:

hi,
add this to your workbook
Add a sheet then hide it. in the code below, change sheet2 to your hidden
sheet.
any time someone saves the file, this cod will run.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("sheet2").Range("A1") = Now()
Sheets("sheet2").Range("A1").Copy
Sheets("sheet2").Range("A1").PasteSpecial xlPasteValues
Sheets("sheet2").Range("A2").Value = Application.UserName
End Sub

regards
FSt1


"SirSimons" wrote:

I need a funktion in my excel sheet, that indicate the person who have saved
a file the last time - Like the NOW() formula, I look for a formula that link
to LastSavedBy

  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Simonsen,

My response got a - embedded in it so wouldn't work.

Look at the function and remove the - between Builtin and DocumentProperties
and see if it works.

If not use this version

'-----------------------------------------------------------------
Function DocProps(prop)
'-----------------------------------------------------------------
Application.Volatile
On Error GoTo err_value
DocProps = ActiveWorkbook.BuiltinDocumentProperties _
(prop)
Exit Function
err_value:
DocProps = CVErr(xlErrValue)
End Function

where you can use the index instead of the name (last author = 7, last save
time = 12)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"SirSimons" wrote in message
...
Thank you for your answers.

I dosen't seems to be working. It could be because I'm running a danish
version og Excel. Anyone who knows where to find that the last author is
defined as "last author" I have tried typing the danish word in the
preferences instead but i doesn't work.

Simonsen

"FSt1" skrev:

hi,
add this to your workbook
Add a sheet then hide it. in the code below, change sheet2 to your

hidden
sheet.
any time someone saves the file, this cod will run.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As

Boolean)
Sheets("sheet2").Range("A1") = Now()
Sheets("sheet2").Range("A1").Copy
Sheets("sheet2").Range("A1").PasteSpecial xlPasteValues
Sheets("sheet2").Range("A2").Value = Application.UserName
End Sub

regards
FSt1


"SirSimons" wrote:

I need a funktion in my excel sheet, that indicate the person who have

saved
a file the last time - Like the NOW() formula, I look for a formula

that link
to LastSavedBy



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



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