BuiltinDocumentProperties - formatting

scotthannaford1973

Board Regular
Joined
Sep 27, 2017
Messages
114
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

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
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
great, thanks for the feedback..

Rob
 
Upvote 0

Forum statistics

Threads
1,216,182
Messages
6,129,360
Members
449,506
Latest member
nomvula

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