PDA

View Full Version : Solved: INCLUDE NAME/MNEMONIC IN MSGBOX



IrishCharm
04-22-2008, 02:00 AM
Hi,

I have a message function that returns data based on what macro etc has been run, kind of like a log of all things run on that day and what time.

I am trying to expand this to who has run what, i.e. there are several people who can run these so i want to add an extra piece in that will identify who has run each macro.

If i could even get the individual mnemonic into a msgbox i could work from there myself, for example john doe's login to a pc could be JD1, or DOEJ or JDOE etc.

Any help would go a long way!!

Sarah

tstav
04-22-2008, 02:20 AM
'Get username
strUser = Environ("UserName")
'strUser = Environ.("UserName")
'Get Computer
strComputer = Environ("ComputerName")
'strComputer = Environ.("ComputerName")

IrishCharm
04-22-2008, 02:24 AM
Hi,

Think my version of Excel may be a bit donkey - i changed it a bit and got it working. Thats's brilliant thanks for all your help, this will work perfectly.

Have a nice day

Sarah


Sub test()
Dim strUser As String
Dim strComputer As String
'Get username
strUser = Environ("UserName")
'Get Computer
strComputer = Environ("ComputerName")
MsgBox strUser
MsgBox strComputer
End Sub

tstav
04-22-2008, 02:45 AM
Computers always know what they're doing Sarah.
Shouldn't have entered the dots (of course...)
:)
Have a nice day