#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto_open and more.... pcor New Users to Excel 2 December 1st 06 02:07 AM
Can I make an Auto_open macro conditional? David M Hargrave Excel Discussion (Misc queries) 2 August 25th 06 10:26 AM
Force read-only in auto_open macro hhalle Excel Discussion (Misc queries) 0 August 20th 06 10:44 AM
Auto_open dan Excel Discussion (Misc queries) 7 May 21st 06 10:41 AM
Help with 'Auto_Open' please... cdavidson Excel Discussion (Misc queries) 3 November 14th 05 04:53 PM


All times are GMT +1. The time now is 02:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"