Environ(UserName) on Remote Machine

Rekd

Banned
Joined
Apr 28, 2010
Messages
136
I've been working on a project for buyers to get data using a userform. If the data they want isn't there they can send a request to me via email to get the data entered.

In the sendmail sub I used

sUserName = Environ("UserName") & "@company.com"

and it worked while I was testing it locally. But when I put the file on the network and the buyer's try to send email it doesn't work. In fact, even though I've put

On Error Resume Next

A few lines above that call to Environ it still errors. Is there another way to get the user name on the remote machines? I don't want the user to have to do anything, well, except to accept the security prompts when I try to access their Outlook via VBA. ;)
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Why not just have them enter their e-mail address on the form?

Especially if you're working across companies, even divisions of the same company, it's unlikely they'll follow the same e-mail naming conventions or logins. There's probably a substantially greater propensity for failure than success with environ in this case.
 
Upvote 0
Why not just have them enter their e-mail address on the form?

Especially if you're working across companies, even divisions of the same company, it's unlikely they'll follow the same e-mail naming conventions or logins. There's probably a substantially greater propensity for failure than success with environ in this case.

I'm trying to eliminate all user input except standard IO. The buyers are all within a few cubes of me and we all have the same standards for addresses; first initial + last name @ company.com.

I suppose I could use Application.Userame then parse their names to build the address.
 
Upvote 0
OK - Then I'd go to one of their machines and see what environ is actually returning.

Or since they're employees, build an employee list that they can select from in a ComboBox. You can pull the e-mail address from a vlookup table.
 
Upvote 0
OK - Then I'd go to one of their machines and see what environ is actually returning.

I did. When run the command from a macro I created on their machine it returns the name as expected. When the macro created on MY machine runs on HIS machine it errors.

Or since they're employees, build an employee list that they can select from in a ComboBox. You can pull the e-mail address from a vlookup table.

That is certainly an option. I could probably narrow it down enough with Application.Username to auto-select their name and they can just click a verify or something.

Now, if I could just get around the Microsoft security when I try to access Outlook. :LOL:
 
Upvote 0
Oooohhh... :biggrin:

Very nice! Who is this Ron guy and how come I haven't found his awesome pages in my searches over the last few months...? :ROFLMAO:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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