Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Identify computer Login ID
I am looking for a way to have Excel identify and record the ID used to log
onto the computer as a way of identifying who has accessed/opened the Excel file. So if I open the Excel file, I want the workbook to record my computer Login ID on a sheet in cell A1. Then if my coworker opens the file I want their ID to be recorded under mine in cell A2, the next coworker in cell A3 and so forth. I found a way to do this operation in Access but now I need the same thing in Excel. Any help is greatly appreciated! Stephen W |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Identify computer Login ID
Try this
Sub test() Dim myUserName As String Dim objNetwork As Object Set objNetwork = CreateObject("Wscript.network") myUserName = objNetwork.UserName Debug.Print myUserName End Sub There may be another way, but it works -- HTH, Barb Reinhardt If this post was helpful to you, please click YES below. "SJW_OST" wrote: I am looking for a way to have Excel identify and record the ID used to log onto the computer as a way of identifying who has accessed/opened the Excel file. So if I open the Excel file, I want the workbook to record my computer Login ID on a sheet in cell A1. Then if my coworker opens the file I want their ID to be recorded under mine in cell A2, the next coworker in cell A3 and so forth. I found a way to do this operation in Access but now I need the same thing in Excel. Any help is greatly appreciated! Stephen W |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Identify computer Login ID
Your code works great.
I found this code that works as well. Sub CaptureUserID() '2 cells must be filled in for this. Enter a character in cell A1 & A2. Dim rng As Range Set rng = Sheets("Sheet3").Range("A1").End(xlDown).Offset(1, 0) rng.Value = Now() rng.Offset(0, 1) = Application.UserName ActiveWorkbook.Save End Sub Thanks for all of your help! Stephen W "Barb Reinhardt" wrote: Try this Sub test() Dim myUserName As String Dim objNetwork As Object Set objNetwork = CreateObject("Wscript.network") myUserName = objNetwork.UserName Debug.Print myUserName End Sub There may be another way, but it works -- HTH, Barb Reinhardt If this post was helpful to you, please click YES below. "SJW_OST" wrote: I am looking for a way to have Excel identify and record the ID used to log onto the computer as a way of identifying who has accessed/opened the Excel file. So if I open the Excel file, I want the workbook to record my computer Login ID on a sheet in cell A1. Then if my coworker opens the file I want their ID to be recorded under mine in cell A2, the next coworker in cell A3 and so forth. I found a way to do this operation in Access but now I need the same thing in Excel. Any help is greatly appreciated! Stephen W |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Identify computer Login ID
Application.Username is just the name typed into
ToolsOptionsGeneralUsername Environ("Username") is the login name. Gord Dibben MS Excel MVP On Wed, 15 Oct 2008 17:06:02 -0700, SJW_OST wrote: Your code works great. I found this code that works as well. Sub CaptureUserID() '2 cells must be filled in for this. Enter a character in cell A1 & A2. Dim rng As Range Set rng = Sheets("Sheet3").Range("A1").End(xlDown).Offset(1, 0) rng.Value = Now() rng.Offset(0, 1) = Application.UserName ActiveWorkbook.Save End Sub Thanks for all of your help! Stephen W "Barb Reinhardt" wrote: Try this Sub test() Dim myUserName As String Dim objNetwork As Object Set objNetwork = CreateObject("Wscript.network") myUserName = objNetwork.UserName Debug.Print myUserName End Sub There may be another way, but it works -- HTH, Barb Reinhardt If this post was helpful to you, please click YES below. "SJW_OST" wrote: I am looking for a way to have Excel identify and record the ID used to log onto the computer as a way of identifying who has accessed/opened the Excel file. So if I open the Excel file, I want the workbook to record my computer Login ID on a sheet in cell A1. Then if my coworker opens the file I want their ID to be recorded under mine in cell A2, the next coworker in cell A3 and so forth. I found a way to do this operation in Access but now I need the same thing in Excel. Any help is greatly appreciated! Stephen W |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Identify User, Copy/Paste Login Info. to File on C:\ | Excel Programming | |||
Identify User, Copy/Paste Login Info. to External File | Excel Programming | |||
Formulaed cell response varies from computer to computer | Excel Discussion (Misc queries) | |||
Display size difference- PC computer vs. Mac computer? | Excel Discussion (Misc queries) | |||
Autocomplete works with my home computer but not the office computer | Excel Discussion (Misc queries) |