BuiltinDocumentProperties - formatting

scotthannaford1973

Board Regular
Joined
Sep 27, 2017
Messages
115
Office Version
  1. 2010
Platform
  1. Windows
Hi

I'm using the following code to create a basic log of when a workbook is saved - and by who. Works fine, does what I want... but the format of the DocumentProperties is coming as surname, first name, organisation - as per our AD set up; am I able to easily change this so it shows as surname and first name only? TIA!

Sub LastSaveAudit()

Sheets("Closed Folder Audit").Select
Range("AN4:AO870").Select
Selection.Cut
ActiveWindow.LargeScroll Down:=0
Range("AN5").Select
ActiveSheet.Paste

Sheets("Closed Folder Audit").Range("AN4").Value = Format(Now, "dd-mmm-yy h-mm-ss")
Sheets("Closed Folder Audit").Range("AO4").Value = ActiveWorkbook.BuiltinDocumentProperties("Last Author")

End Sub


1714730056410.png
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Use InStr to find the position of the opening bracket, combined with Left to return everything before that.
 
Upvote 1
Hi,

assuming your authors ALL have comma separators between their names, perhaps this might work for you:

VBA Code:
Sub LastSaveAudit()

Sheets("Closed Folder Audit").Select
Range("AN4:AO870").Select
Selection.Cut
ActiveWindow.LargeScroll Down:=0
Range("AN5").Select
ActiveSheet.Paste

Sheets("Closed Folder Audit").Range("AN4").Value = Format(Now, "dd-mmm-yy h-mm-ss")

authorname = ActiveWorkbook.BuiltinDocumentProperties("Last Author")
mycount = InStr(authorname, ",") 'finds comma seperator
myname = Left(authorname, InStr(mycount + 2, authorname, " ") - 1) 'starts to count 2 letters after the "," and looks for next " " space.

Sheets("Closed Folder Audit").Range("AO4").Value = myname


End Sub
 
Upvote 1
Solution
Hi,

assuming your authors ALL have comma separators between their names, perhaps this might work for you:

VBA Code:
Sub LastSaveAudit()

Sheets("Closed Folder Audit").Select
Range("AN4:AO870").Select
Selection.Cut
ActiveWindow.LargeScroll Down:=0
Range("AN5").Select
ActiveSheet.Paste

Sheets("Closed Folder Audit").Range("AN4").Value = Format(Now, "dd-mmm-yy h-mm-ss")

authorname = ActiveWorkbook.BuiltinDocumentProperties("Last Author")
mycount = InStr(authorname, ",") 'finds comma seperator
myname = Left(authorname, InStr(mycount + 2, authorname, " ") - 1) 'starts to count 2 letters after the "," and looks for next " " space.

Sheets("Closed Folder Audit").Range("AO4").Value = myname


End Sub
thanks, that looks good
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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