ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto_Open Macro (https://www.excelbanter.com/excel-discussion-misc-queries/138530-auto_open-macro.html)

Trying To Excel

Auto_Open Macro
 
Can I creat a Macro to prompt a user to enter their name which would then
propogate to the "Username" value on the General Tab under Tools\Options menu?

I have several users accessing the file from various computers and Windows
login.
I know there is a way to update the username using VBasic to cooincide with
the Windows log in but I am not familiar enough with VB to do it.

If I could record a macro and save it as Auto_open this would work. I also
do not want the Tools\Options\General window to be displayed wen the macro
runs. I just want the username to be updated based on the information entered
in the prompt window.

Thanks
Martin

Bob Phillips

Auto_Open Macro
 
No need to prompt


Private Sub Workbook_Open()
Application.UserName = Environ("UserName")
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Trying to Excel" wrote in message
...
Can I creat a Macro to prompt a user to enter their name which would then
propogate to the "Username" value on the General Tab under Tools\Options
menu?

I have several users accessing the file from various computers and Windows
login.
I know there is a way to update the username using VBasic to cooincide
with
the Windows log in but I am not familiar enough with VB to do it.

If I could record a macro and save it as Auto_open this would work. I also
do not want the Tools\Options\General window to be displayed wen the macro
runs. I just want the username to be updated based on the information
entered
in the prompt window.

Thanks
Martin




Trying To Excel

Auto_Open Macro
 
Hi Bob,

This worked very well.
Thank you for your assistance.

Martin

"Bob Phillips" wrote:

No need to prompt


Private Sub Workbook_Open()
Application.UserName = Environ("UserName")
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Trying to Excel" wrote in message
...
Can I creat a Macro to prompt a user to enter their name which would then
propogate to the "Username" value on the General Tab under Tools\Options
menu?

I have several users accessing the file from various computers and Windows
login.
I know there is a way to update the username using VBasic to cooincide
with
the Windows log in but I am not familiar enough with VB to do it.

If I could record a macro and save it as Auto_open this would work. I also
do not want the Tools\Options\General window to be displayed wen the macro
runs. I just want the username to be updated based on the information
entered
in the prompt window.

Thanks
Martin






All times are GMT +1. The time now is 04:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com