Excel/VBA Environ("username") error
<p>I have a spreadsheet that contains a range of model inputs that get loaded into a SQL Server database. Part of this process involves building an audit trail of who updated what and when - I record the user and machine name as well as timestamp.</p>

<p>Within my VBA code, I have the following:</p>

<p>user = VBA.environ$("username")</p>

<p>This is running on a Win7 machine, with Office 2013.</p>

<p>When I run the code, it all works fine, but when someone in production runs it (on the same machine, but they are logged in, not me), it falls over on the line above. I have used variations of the above (user = environ("username"), user = environ$("username")) but always with the same outcome - it works for me, but not for others.</p>

<p>Does anyone have any thoughts on how to fix this?</p>