+ Reply to Thread
Results 1 to 6 of 6

Document Properties "Last Author" change to surname

  1. #1
    Registered User
    Join Date
    05-03-2017
    Location
    Slovakia
    MS-Off Ver
    2019 & 365
    Posts
    32

    Document Properties "Last Author" change to surname

    Hi! I'm new to this macro thing so please be gentle with me I need help with somehow changing "Windows account name" into "Surname". Let me explain...

    So, I have this line in my macro:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    And it gives me basically "Windows account name" into cell A1. And that is good.
    But now I need to change this "Windows account name" into "Surname" of person who's using that Windows account.
    And this surname should be in B1.

    So I need something like this:

    "Windows account name1" = "Parker"
    "Windows account name2" = "Smith"
    "Windows account name3" = "Black"
    "Windows account name not on this list" = "Unknown"


    I hope you can understand what I need. Can you help me with this? Thank you.

  2. #2
    Valued Forum Contributor
    Join Date
    01-07-2022
    Location
    Europe
    MS-Off Ver
    Office 365
    Posts
    473

    Re: Document Properties "Last Author" change to surname

    you can use something like this to extract the surname, as the last word in the 'Last Author' string:

    Please Login or Register  to view this content.
    Not sure what you mean by the list though e.g. Windows account name not on this list" = "Unknown". Do you have a list of usernames somewhere, and are they stored in a workbook or hardcoded into the VBA?
    <<< If you have valued anyone's contributions in this thread, please click * to thank them for their efforts

  3. #3
    Registered User
    Join Date
    05-03-2017
    Location
    Slovakia
    MS-Off Ver
    2019 & 365
    Posts
    32

    Re: Document Properties "Last Author" change to surname

    Maybe I explained it wrong.

    Windows account name is not always "Name & Surname" but it can be whatever (nickname, PC name, etc..). So I just need to assign that "this windows account name" is "this person", etc. So I need some kind of list of windows account names with assigned real names and also when there's no account name on the list, it just gives me "Unknown".

  4. #4
    Valued Forum Contributor
    Join Date
    01-07-2022
    Location
    Europe
    MS-Off Ver
    Office 365
    Posts
    473

    Re: Document Properties "Last Author" change to surname

    Ah, I see. Something like this?

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor
    Join Date
    01-07-2022
    Location
    Europe
    MS-Off Ver
    Office 365
    Posts
    473

    Re: Document Properties "Last Author" change to surname

    ah sorry, I think I understand now.

    You want to manually insert a list of usernames in Column A, and a list of Surnames in Column B.

    The macro checks the lastauthor name against this table, and uses it to update the last author saved to the file.

    Is that correct? If so I'll try take another look at the code later

  6. #6
    Valued Forum Contributor
    Join Date
    01-07-2022
    Location
    Europe
    MS-Off Ver
    Office 365
    Posts
    473

    Re: Document Properties "Last Author" change to surname

    Just took a quick look at the documentation for this one: https://docs.microsoft.com/en-us/off...mentproperties

    The 'Last Author' is stored as one of many document properties when a user saves a workbook. As far as I can tell it's only read-only, so you can't overwrite it using VBA (unless anyone else on the forum is aware of how to do this?)

    The other challenge is that even if you could change it, when you save the file it will overwrite it with your own username...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Use "Excel Document Properties" within Worksheet/Workbook
    By gijoeblack in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 02-11-2022, 12:41 PM
  2. Replies: 3
    Last Post: 09-26-2021, 08:54 AM
  3. Replies: 3
    Last Post: 09-26-2019, 12:25 PM
  4. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  5. Parse first name & surname from Windows logon name (Environ("UserName")
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2013, 08:08 PM
  6. [SOLVED] Scroll Bar missing "Control" tab in "Format Properties" dialog box
    By Peter Rooney in forum Excel General
    Replies: 5
    Last Post: 02-14-2012, 01:45 AM
  7. Change "Properties" of files
    By Sige in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1