Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-31-2011, 11:57 AM
djreyrey djreyrey is offline ** Using Functions Windows 7 ** Using Functions Office 2007
Novice
** Using Functions
 
Join Date: Mar 2010
Posts: 21
djreyrey is on a distinguished road
Exclamation ** Using Functions

Hello all! Thank you for stopping by.

I'm using the following functions in Excel 07 to retrieve the date and user name of the person who entered a new row. However, when I open the spreadsheet, the existing rows with user names update to my user name. Also, instead of the date showing when the row was entered, it updates to today's date. I don't want the information to change everytime I open the spreadsheet. It should reflect the user name who entered the new row. Here are the functions I'm using:

Code:
Declare Function apiGetUserName Lib "advapi32.dll" Alias _
                 "GetUserNameA" (ByVal lpBuffer As String, _
                 nSize As Long) As Long
 
Function GetUserName() As String
    Application.Volatile
    Dim sBuff As String * 25
    Dim lBuffLen As Long
 
    lBuffLen = 25
    apiGetUserName sBuff, lBuffLen
    GetUserName = Left(sBuff, lBuffLen - 1)
 
End Function
 
Function DateAndTime()
    DateAndTime = Now
End Function
The functions are called by using the following formulas (respectively):

Quote:
=IF(C199>0, GetUserName(), "")
Quote:
=IF(C199>0, DateAndTime(), "")
I really appreciate your time!!



Thank you,

Rey
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop Down List and Functions (Linking) sten Excel 0 03-17-2010 03:03 PM
Auto-updating basic math functions & cross-referencing tables FranklinBluth Word Tables 13 11-19-2009 10:26 AM
Automated Functions?? nickypatterson Outlook 0 08-27-2009 01:50 PM
Merging a Word doc with VB functions contained adamwbrown Word 0 08-13-2008 06:10 AM
How to show help for addin functions? Movses Asatryan Excel 0 03-02-2006 05:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:33 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft