+ Reply to Thread
Results 1 to 8 of 8

Macro to prompt user for name

  1. #1
    Registered User
    Join Date
    03-07-2012
    Location
    Cali
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro to prompt user for name

    I have an accounting workbook and I would like it prompt the user who opens it to enter their name (to create a log of who uses it). I've only found examples that use the user's name to prompt another macro to run, but that's not what I want. I simply want it to store whatever name they enter in a cell on a worksheet. Thanks in advance

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Anybody know a macro that prompts user for their name,and then stores that name on a s

    Hi

    Why prompt for the name when you can use a workbooks_open event to capture either the username or environment username (if they are different) and automatically store it?

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    06-27-2008
    Location
    Florida
    Posts
    36

    Re: Macro to prompt user for name

    Could workbooks_open be used to "require" a user to enter information based upon the value placed in a cell? I'm working on an evaluation program, and when a trainer scores someone with an unacceptable score, the trainer needs to provide comments to justify the low score. I'd like excel to "require" that automatically based on the score.

  4. #4
    Registered User
    Join Date
    03-07-2012
    Location
    Cali
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Anybody know a macro that prompts user for their name,and then stores that name on a s

    Quote Originally Posted by rylo View Post
    Hi

    Why prompt for the name when you can use a workbooks_open event to capture either the username or environment username (if they are different) and automatically store it?

    Please Login or Register  to view this content.
    rylo

    thanks for the reply. I should have mentioned I'm still pretty new to macros. If I already have an "auto open" macro can I just add your code to that macro? or is workbook _open different than auto_open? Do I have to edit your code in anyway to make it work on my workbook?

  5. #5
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro to prompt user for name

    Hi

    You should be able to just add my code to any existing auto_open macro you have. Now having said that, just watch something go wrong!

    rylo

  6. #6
    Registered User
    Join Date
    03-07-2012
    Location
    Cali
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to prompt user for name

    Not sure what I'm doing wrong, but I can't get it to work. This is what I'm doing:
    record macro-->edit macro-->paste the code from above-->stop recording-->save-->run macro

    It gives me an error if I leave in the workbook_open part, so here is the code I'm trying to use

    Please Login or Register  to view this content.
    any ideas on why it won't work?

    I can't put my workbook in this thread but I'll PM it to anybody if they think they can figure it out.
    Last edited by olazabal; 03-21-2012 at 07:23 AM.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to prompt user for name

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  8. #8
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Macro to prompt user for name

    Hi

    You only need to add the actual code, not the sub / end sub components. I thought you were going to add them to an existing auto_open macro? This just seems to be added to a new one.

    Put up an example workbook with the code in it so we can see what you are doing.

    rylo

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1