VBA User Information Msgbox

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
657
Hello everyone,

I'm using an excel sheet that can be accessed by many users.

When each user opens their excel document, in the top right hand side of the screen appears the user's name.

My question is, could I launch a msgbox popup to include the name of the user who is signed in in a message box popup?

For example, an employee named Bob Parker is signed into their excel document as Parker, Bob.

Could a msgbox would be designed to include the user's name?

For example:
VBA Code:
 Msgbox " [Username] Hello!"
would appear
"Bob Parker Hello!"
when run.

Is this possible?

Please let me know when you get a chance.

Thank you,
pinaceous
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,263
Office Version
  1. 365
Platform
  1. Windows
Try this.
VBA Code:
MsgBox Application.UserName & " Hello!"
 

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
657
Hi Norie,

The way that the administrator setup the excel, that approach did not work.

The message box pops back authorized user in place of the application.username.

Is there any additional information that I could provide to help you?

Thank you,
pinaceous
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,263
Office Version
  1. 365
Platform
  1. Windows
You could try using Environ("Username") instead.
 

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
657

ADVERTISEMENT

Could you please give me an example in a code?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,263
Office Version
  1. 365
Platform
  1. Windows
All you need to do is replace Application.UserName.
VBA Code:
MsgBox Environ("UserName") & " Hello!"
 

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
657
Hi Norie,

It does work but it displays the employees code that is assigned to each individual in using the code from Post#7.

Is there some other code that we can try to isolate the name, which is signed into the excel sheet?

Thank you,
pinaceous
 

Watch MrExcel Video

Forum statistics

Threads
1,127,100
Messages
5,622,714
Members
415,922
Latest member
gemmatay88

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
Top