Last saved by

A

Arne Hegefors

Hi! I have a macro that shows in a messagebox who used the most recent user
of a file is. It runs when the workbook is opened. Now I want to show who and
when saved the file the last time. How do I do that? Thanks!

Sub Auto_Open()
Dim lngRäknare As Long, strSenastÖppnad As String
Dim strMeddelande As String, strSenastAnvänd As String, strSenastSparad
As String

'Hämtar data från Registry
lngRäknare = GetSetting("Filinformation", "Fildata", "Antal", 0)
strSenastÖppnad = GetSetting("Filinformation", "Fildata", "Öppnad", "")
strSenastAnvänd = GetSetting("Filinformation", "Fildata", "Använd", "")
strSenastSparad = GetSetting("Filinformation", "Fildata", "Sparad", "")
'Visa information i messagebox
strMeddelande = "Den här filen är öppnad " & lngRäknare & " gånger."
strMeddelande = strMeddelande & vbNewLine & "Filen var senast öppnad: " _
& strSenastÖppnad
strMeddelande = strMeddelande & vbNewLine & "Filen användes senast av " _
& strSenastAnvänd

MsgBox "test" & strSenastSparad

MsgBox strMeddelande, vbInformation, ThisWorkbook.Name

'Uppdatera informationen och lagra den nya
lngRäknare = lngRäknare + 1
strSenastÖppnad = Date & " " & Time
strSenastAnvänd = Application.UserName

SaveSetting "Filinformation", "Fildata", "Antal", lngRäknare
SaveSetting "Filinformation", "Fildata", "Öppnad", strSenastÖppnad
SaveSetting "Filinformation", "Fildata", "Använd", strSenastAnvänd

End Sub
 
M

Mike H

Hi Arne,

I'm struggling with some of your variable names so in English try this:-

Sub stance()
MsgBox ThisWorkbook.BuiltinDocumentProperties("Last author").Value
End Sub

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

ranges 5

Top