Display Username And Welcome Message

  • Thought I'd post up a little code I wrote a while back for an app I was developing... kind of useless but its pretty cool. This will get the user name of the computer and display a personal message based on what time the windows clock is set to.




    hmm, somehow the code is putting spaces where the apostrophe is in the formular1c1.. just remember to take it out

  • Re: Display Username And Welcome Message


    Here's another way


  • Re: Display Username And Welcome Message


    thumbs up to that Roy! I wrote what I had a ways back before I was really into vba, good call on the case structure tho.

  • Re: Display Username And Welcome Message


    Hi Roy


    This may be a silly question(i may be missing something entirely here), but I dont think all the hour are covered.


    What happens if its before Hour 11 but after Hour 6 ?


    Could we include something like :


    Code
    Case Else
            sTxt = "Good Morning, "
        End Select
  • Re: Display Username And Welcome Message


    Yea, that should work, excel newbie. Also, I'm not sure why I had '11' there instead of 12... it might have been because excel considered 12am to be the hour 00...

  • Re: Display Username And Welcome Message


    RoyUK, I used your code but only my name appears not the GoodEvening messages etc. Any ideas?

  • Re: Display Username And Welcome Message


    Quote from Hello

    RoyUK, I used your code but only my name appears not the GoodEvening messages etc. Any ideas?


    If youv' copied & pasted correctly then it should work

  • Re: Display Username And Welcome Message


    hi
    If I want to add time and Date to it, how to do so?
    like
    "Good Morning <USER NAME>, It is 5.50am 29.01.07. Have a good day! - administrater"


    jai

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!