Author Name and User Name - Does anyone know the VBA and cell formulas to use?

Tyron

Active Member
Joined
Dec 5, 2012
Messages
258
Hey Guys,

Probably something that isn't very hard. I have actually found out how to do the User Name.

VBA:
Code:
Username = Environ("UserName")
Cell Formula:
Code:
=Username()
This takes care of the Username.

I can't, for some reason, find anything online about grabbing the workbook's author(s) name though. Anyone out there know how to do this?

later

Ty
 

L. Howard

Well-known Member
Joined
Oct 16, 2012
Messages
4,514
Hi Tyron,

With the function in a standard module.
Use this on the worksheet

=LastAuthor()

Code:
Option Explicit

Public Function LastAuthor() As String
   Application.Volatile
   LastAuthor = ThisWorkbook.BuiltinDocumentProperties("Last Author")
End Function
Or with this sub in the sheet module and the above function in a standard module.
To list author in a cell by code.

Code:
Sub MisterAuthor()
 Range("C1").Formula = "=LastAuthor()"
End Sub
Regards,
Howard
 

Tyron

Active Member
Joined
Dec 5, 2012
Messages
258
Hey L. Howard,

Thanks for the reply. I will give it a try and let you know how it goes.

In your first example it seems to show that you have created a UDF and make a call to that UDF with the =LastAuthor(). Is this correct?

Also, would I be able to just type =builtindocoumentproperties.lastauthor("Last Author")
in a cell so I would not need any VBA?

I apologize if my previous post is confusing. I was actually looking for two different independent ways to find the information. 1.)using VBA so I can make it part of my macro 2.)Using Excel formula only so I can verify the information through a second source that isn't part of the macro.

Thanks again for your help.

Ty
 

L. Howard

Well-known Member
Joined
Oct 16, 2012
Messages
4,514
Hi Tyron,

Code:
In your first example it seems to show that you have created a UDF and make a call to that UDF with the =LastAuthor(). Is this correct?
Yes, that is true.


Code:
Also, would I be able to just type =builtindocoumentproperties.lastauthor("Last Author")
 in a cell so I would not need any VBA?

2.)Using Excel formula only so I can verify the information through a second source that isn't part of the macro.
Not that I know of. But may be possible.


Code:
1.)using VBA so I can make it part of my macro
The function I googled and posted does that, if I read you correct.

Put this in a standard module and type in two XX's in F1, then run Sub UseMyLastAuthor()


Code:
Option Explicit

Public Function LastAuthor() As String
   Application.Volatile
   LastAuthor = ThisWorkbook.BuiltinDocumentProperties("Last Author")
End Function

Sub UseMyLastAuthor()
If Range("F1") = "XX" Then

  MsgBox "There are two XX's in Cell F1 and they were put there by " _
         & vbCr & LastAuthor() & vbCr & "That is me."

End If
End Sub
Howard
 

Tyron

Active Member
Joined
Dec 5, 2012
Messages
258
Hey L. Howard,

Thanks for your help. I have discovered I think a problem though. It seems to be getting the name from somewhere other than the author. I guess I would need to know where it gets the name from within excel. I only say this because it runs normal, but for the name it is blank. This is strange.

I am unable to substantiate whether we can just directly put the information in to a cell formula as I cannot get the UDF to work. Probably not the UDF's fault. I just need to find out where in the computer I can go to visually confirm and/or change the "Authors" name so that it can work.

Let me know if you figure it. I am off to hunt this bugger down.

later

Ty
 

Forum statistics

Threads
1,082,250
Messages
5,364,020
Members
400,774
Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top