Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
zulfer7
 
Posts: n/a
Default PLEAS HELP! Newby Needs help Populating Cell w/ Application.usern

Sub Populate_Username

Dim Text as String

Range("A2").Select
text = application.username

This does not populate the application.username at cell A2 so what needs to
be done to this code?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Nick Hodge
 
Posts: n/a
Default PLEAS HELP! Newby Needs help Populating Cell w/ Application.usern

Range("A2").Value=Application.UserName

This will put in the username in ToolsOptions...General, NOT the network
or machine logon

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"zulfer7" wrote in message
...
Sub Populate_Username

Dim Text as String

Range("A2").Select
text = application.username

This does not populate the application.username at cell A2 so what needs
to
be done to this code?



  #3   Report Post  
Posted to microsoft.public.excel.misc
Steve Wright
 
Posts: n/a
Default PLEAS HELP! Newby Needs help Populating Cell w/ Application.usern

The following will put the windows username in a cell. You will need to
change the sheetnames to suit your workbook and fiddle with the rest of the
code to make it do what you want.

Steve


-------------------------------
Option Explicit


Private Declare Function GetUserNameAPI Lib "advapi32.dll" Alias
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long)
As Long

Public Function GetUserName() As String
Dim sBuffer As String
Dim lSize As Long
Dim lRV As Long

lSize = 255
sBuffer = String(lSize, &H0)

lRV = GetUserNameAPI(sBuffer, lSize)

If lRV < 0 Then
GetUserName = Left(sBuffer, lSize - 1) ' -1 to remove trailing null
character
Else
GetUserName = ""
End If
End Function

Sub EnterUser()
Worksheets("Use Log").Visible = True
Worksheets("Use Log").Select
Range("a1").Select
Range("A65536").End(xlUp).Offset(1, 0).Select
ActiveCell.Value = GetUserName
ActiveCell.Offset(0, 1).Value = Now
Worksheets("Use Log").Visible = False
Worksheets("Main").Select
End Sub

--------------------------------------

"Nick Hodge" wrote in message
...
Range("A2").Value=Application.UserName

This will put in the username in ToolsOptions...General, NOT the network
or machine logon

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"zulfer7" wrote in message
...
Sub Populate_Username

Dim Text as String

Range("A2").Select
text = application.username

This does not populate the application.username at cell A2 so what needs
to
be done to this code?





  #4   Report Post  
Posted to microsoft.public.excel.misc
zulfer7
 
Posts: n/a
Default PLEAS HELP! Newby Needs help Populating Cell w/ Application.u

THIS WAS PERFECT, Thanks!

"Nick Hodge" wrote:

Range("A2").Value=Application.UserName

This will put in the username in ToolsOptions...General, NOT the network
or machine logon

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"zulfer7" wrote in message
...
Sub Populate_Username

Dim Text as String

Range("A2").Select
text = application.username

This does not populate the application.username at cell A2 so what needs
to
be done to this code?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
resetting last cell jagdish.eashwar Excel Discussion (Misc queries) 11 March 31st 06 02:06 AM
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Dates of a Day for a month & year cell formulas mikeburg Excel Discussion (Misc queries) 2 December 29th 05 10:14 PM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


All times are GMT +1. The time now is 05:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"