Messagebox with date and last updated by information

anderma8

New Member
Joined
Oct 29, 2008
Messages
40
Office Version
  1. 365
Platform
  1. Windows
I'm pretty sure this can be done in VB, but I'm just starting to dabble in VB - so here it goes: When a file is open, I'd like to have a messagebox display the message, "File [filename] was last update by NAME on DATE"

I'm assuming VB would be the place to do this? Has anyone done something similar?
Thanks in advance!
Mark
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You could place this code in a workbook open event.

It would keep a record of the last person to open the workbook and date ( not necessarily amended)


sorry for some reason my pc will not let me copy to this sheet This code needs to go into a workbook open event

dim NextRow as long
dim I as String

NextRow = Cells(Rows.count,1).End(xlUp).row

Worksheets("Sheet2").Cells(NextRow +1,1)= Application.UserName & " " & Date

I = Worksheets("Sheet2").Cells(NextRow,1).Value

MsgBox "The last person to use this workbook was" & " " & i
 
Upvote 0
Whichever sheet you choose make sure that A1 at least has a heading.
the message will return the heading on the first time opening
 
Upvote 0
You could try placing this code in the ThisWorkbook module of the file in question. It would need to be saved as a macro-enabled workbook and the user would have to have macros enabled when opening it to get the message. Note that, as Dryver14 also mentioned, there is no guarantee that the person who last saved the file actually made any changes to it
Code:
Private Sub Workbook_Open()
  Dim sName As String, sLastAuthor As String, sLastSaved As String
  
  With ThisWorkbook
    sName = .Name
    sLastAuthor = .BuiltinDocumentProperties("Last Author")
    sLastSaved = .BuiltinDocumentProperties("Last Save Time")
  End With
  MsgBox "File " & sName & " was last saved by " & sLastAuthor & " on " & sLastSaved
End Sub


@ Dryver14
Re the problem pasting code. Are you using Edge as your browser? If so, refer to this thread
 
Last edited:
Upvote 0
Peter_SSs,
It took about 1 1/2 minutes to implement what you posted and it's EXACTLY what I was looking for!

Much appreciated!
Mark
 
Upvote 0
Peter_SSs,
It took about 1 1/2 minutes to implement what you posted and it's EXACTLY what I was looking for!

Much appreciated!
Mark
Great news! Thanks for letting us know.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,164
Members
453,021
Latest member
Justyna P

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