I am trying to get the username from the system to display in A1 in a file in Excel. I got this code form internet and put it in the sheet by clicking right mouse on the sheet1 tab and view code and then pasted it there.
Function UserNameWindows() As String
UserNameWindows = Environ("USRNAME")
End Function
And then as per the instructions on the same page I inserted this formula in A1 : =UserNameWindows()
The person stated that by doing this, I should be able to get user name displayed in A1. BUt all it gives me is #NAME?.
Trying to get a record of who authorized spending in one of my worksheets and when they did it
I had some VBA code in one of my worksheets which added a time stamp and a user ID to two different cells after the user enters their name. Why it is no longer working, though I suspect after moving the worksheet around.
I would like my users to type their name into cell G65 (which is actually merged from G65-K65). Once the user enters their name, cell L65 (which is actually merged L65-O65) populates with the current time stamp. Also, when the user enters their name into cell G65, I would like cell P65 (which is actually merged into P65-S65) to auto populate. I would like this all of this to go down through line 70.
I have searched the forum several way to resolve my issue and the only solutions were as follows:
PHP Public Function UserName()UserName = Environ("username")UserName = Computer("UserName")End FunctionOption ExplicitFunction NetworkUserName() As StringDim responseNetworkUserName = Environ("Username")End Function
Problem is that I get a #REF! and #NAME? instead of the user names I am using Excel 2000 (I can not upgrade, Government PC) plus we need it to support Excel 2000 - present versions.
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long
Public Function UserName() As String Dim Buffer As String * 100 Dim BuffLen As Long On Error GoTo UNerr
[Code] ......
I found the code online and attempted to call the user name using =username() on the specified cell, but I receive the #NAME? error. I looked around and found several references to check the VB refence box for anything missing and I did not find anything incorrect.
To note, I am attempting this at my job's PC which will be used on other employees PC's as well.
Is there a way to have a formula or a VBA code associated to the choice of any value in a Validation list.
For example is there a way to have lets say in A1 a validation list and to have B2 returning the username of the person of who will select a value in A1?
I trying to create a paperless petty cash system. I have my sheet all setup and calculating how I want. When a user makes an entry they Enter their name in column "W".
I am trying to overcome the problem of accountability. I need to achieve a cell calls for Username and Password and if correct the persons name is entered into cell then Row is locked to prevent figures being altered etc. But also if user made mistake they need to unlock it somehow someway
Sure this achievable from snippets of info I seen online but its way beyond my abilities. I realise a determined user can circumvent this if they wanted to.
If Range("a1").Value = Range("H5").Value Then format.cell("c24")Protection=unlocked
I will have someone type in their supervisor's name in H5. When they send the form to their supervisor and A1 matches the entry in H5, I want cell c24 to be unlocked so the supervisor can make an entry.
i have the following code to insert comments into cells, however if the user cancels the input box (i.e. doesn't insert any text), a comment is still added with their details and the comment 'FALSE'. Is there anyway to stop comments being added if the user cancels the input?
Sub Insert_Comment() Dim iReply As Integer
Dim cl As Range Dim sComment As String Dim sText As String Dim UserNameWindows As String
I am looking to have a macro which will automatically add the username and date to a cell, when the cell above changes (or in this case =x). I have a bit of code from a previous project, but I have changed Target.Row to Target.Column and it is not behaving as I require:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range("B2:BZ2"), Target) Is Nothing Then Range("C" & Target.Column).Value = Format(Date, "dd-mmm") & " " & Format(Time, "hh:mm") & " by " & (Application.UserName) End If End Sub
See the attachment for the example. What I need is whenever row 3 ="x" I need the corresponding cell in row "d" to update with the latest date, time and username. Please not the macro is currently not active on the sheet as i've added the ' character.
When I hover the mouse over a cell with comments, the status bar displays a message; for example "Cell A12 commented by A satisfied Microsoft Office user".
I only get this message for one column. The cells in all other columns give my first and second name as the author of the cell comment.
Why it is only effecting one column. I have been unable to change the annoying "commented by A satisfied Microsoft Office user" to my own name.
Is there a macro that can do this? I tried two macros I found online, both from a few years back, but neither of them worked.
I have Timesheet workbooks with 3 levels of access (user, viewer & me as developer).
I want use the GetuserName API function (with If/Then) to auto open the wkbk if I am loged in under my network login so psuecode looks bit like this
If network user is me then open wkbk else ask for username & password
I have googled & searched the forum & the closest I have is this
Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function ReturnUserName() As String ' returns the NT Domain User Name Dim rString As String * 255, sLen As Long, tString As String tString = "" On Error Resume Next...............
I've got a sheet with a "Last Edited By:" field and I want this to be populated with the current users name i.e. I suppose I mean the user name that is assigned to Excel, as opposed to the XP log in... although I guess either would do. I'm OK on the change event thing, but just dont know the function to find the the current users name.
I'm trying to use the code listed below on the works shared drive. When I open up the worksheet and save it, my log on identity is left as required in Cell B2 etc.. When someone else uses the sheet it just leaves the company name in this cell and not their log on identity? The date & time function always works ok. Can anyone advise me if what I'm after is achievable.
The code I've used below was used from a previous string on a similar question.
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Range("A" & Rows.Count).End(xlUp).Offset(1).Value = Now() Range("A" & Rows.Count).End(xlUp).Offset(0, 1).Value = Application.UserName End Sub[/b]
I have copied a macro off another board that get the username of the computer where the excel file is opened. It works fine on my pc but when I have sent the workbook to a colleague my username came up when he opened it. Also what I am trying to do is to modify the macro that does a vlookup on a range in worksheet 1 from where it picks name and surname (and transpose it onto worksheet 2 on cell A2), email (on B2), tel number (on C2) etc etc.
I have below piece of code which I'm not sure how to finish up. What I'm trying to do is have 'Username' and 'password' entered before logging into the workbook. It does not have to be 'UserForm" if it is possible, but it would be useful if we use Ucase...
I'm just not sure how this code works with
"Sub sUserLogon(strStandardID As String, strPassword As String)"
stated in this way..
VB: Sub sUserLogon(strStandardID As String, strPassword As String) Dim strUserName As String Dim StrMessage As String Application.DisplayAlertsAlerts = False StrMessage = "User Logged In"
I would like to unlock the work sheet based on the username. However this code does not seems to be working.
The object is that only these users have access to the locked cells on a sheet and those users not on the list would only have access to the unlocked cells.
This time stamp macro is great but I would also like to record the person who said 'Y' in the same cell as the date stamp '12:00p.m. MWatson'. The persons name should come from the Username.
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count > 1 Then Exit Sub If Not Intersect(Target, Range([P13], Cells(Rows.Count, "p"))) Is Nothing Then 'change your range on this line" With ActiveSheet If Target.Value = "Y" Then Target.Offset(0, 1).Value = Now
I am using the below code to access a website with IE.
My next step (of many) is to Login to this website.
The login screen requires that I enter: User Name: Password:
How can I tell IE to enter my user name and Password?
Sub Macro2() ' 'Macro2 Macro ' Macro recorded 2/6/2007 by dsggodwin Public Sub Goto_ToyotaSupplier_Click() Dim EXP
Set EXP = CreateObject("InternetExplorer.application") EXP.Visible = True 'put the webpage here EXP.Navigate ("https://www.portal.toyotasupplier.com/skpi/SkpiGatewayServlet?jadeAction=NCPARTS_SEARCH") End Sub
i need a macro that will only open a file to certain users using the "get username" environ thing,
and only allow a list of users to access this file,
this will be a log of things that only managers whouls have access to, i have all the managers usernames (windows log ons) and what i need is that if the log on on the current machine, (the one currently opening the file) does not match one on th elist then the file should not open.
i could pasword protect the file but since my managers are kinda lazy and i wnat to show off a little (maybe hopefully that will push my promotion forward a couple of days at least)
I'm trying to create a program that will automatically log in to a website that requires a username & password. I am able to enter the username and password in the correct text boxes, but I can not get the form to submit to approve the login. It refreshes and removes the password.
I have attached my code. The web url is inside it.
Sub IE_login() Dim ie As InternetExplorer Dim C Dim ULogin As Boolean, ieForm Dim MyPass As String, MyLogin As String Set ie = New InternetExplorer ie.Visible = True ie.Navigate "https://applications.dacgroup.com/login.aspx" 'Loop until ie page is fully loaded Do Until ie.ReadyState = READYSTATE_COMPLETE Loop
I have a problem with the Excel UserName & opening of a second xls File. Info: The first file macro, looks as to the Excel UserName, and sets which worksheets from a second file in the network the person can see. then changes the Excel UserName to "helpdl", this is done because only 4 people have access to the Workbook on a network drive, see Code below (only the interesting part of the macro)
'Set the Excel UserName to "helpdl" '(from Sub Change_UserName) MyName = Application.UserName OName = MyName NewName = "HelpDL" UserName = NewName 'Set the name of the Active File To "Slave" Set wbSlave = ActiveWorkbook 'Open the Master from the Network (Wiesbaden server sv030100) Workbooks.Open "\sv030100GruppenDL60116_MEWA Car Policy_Neukonzeption.xls" 'Set the name of the Active File to "Master" Set wbMaster = ActiveWorkbook...........................
1) navigate to a web page 2) submit my userId and password 3) beeing redirected to a different url I have to menage this situation for passing url to 4) quering sub
I am using Excel 2000 with win98 Error 429 Can't create object:which one?
Public Sub First() Dim obEx As Object Dim obj As New MSHTML.HTMLBody Dim strPass As String Dim elUid As New MSHTML.HTMLInputElement Dim elPass As New MSHTML.HTMLInputElement Dim elSubmit As New MSHTML.HTMLInputElement Dim strUid As String Dim Desc As String
I have an Excel macro that pulls an external .txt file from a particular directory on a users computer. The directory is different for each user because of the way the computers are configured, see example below.
Bob's computer: c:obwork
Jill's computer: c:jillwork
There is a system variable called %username% on each computer that can be used for navigation in an OS enviroment. So if you were at the command prompt on user's computer and typed cd\%username%work you would be put in the desired directory. Is there a way to leverage this system level variable, %username%, in an Excel macro?
Usually when you try to open a file that someone else is using, it lets you know the file is in use, and lets you know who is using it. However, the situation I have is that when a user tries to open the file that is in use, it tells them that the file is in use, but gives them the wrong user who is using it!
For example, User1 opens the file and closes it again. User2 comes along and opens the file and stays in the file. User3 comes along and tries to open the file, but instead of saying User2 is using the file. It says User1 is using!
The file we have was originally built in Excel 97, but we using it through compatibility mode in Office 2007. The file is needed by various users, but putting it on shared access is not an option.
I have a list of tweets, and I would like to extract just the username found within the tweet. I'm not sure if a formula is the best way to do this, or possibly a macro.
The example I've attached is only of 18 tweets, but the spreadsheet I'm looking to use this on is 100,000+ tweets, so I need something easily scalable. One thing to note is that a tweet can have more than oneuser mentioned in it, such as the first tweet in the example.