![]() |
Getting open file's directory, captureing user login ID, write access
I have a few questions.
1: How can I get the directory for the currently opened excel file? 2: Is there a way to capture the login ID for the user currently using the excel macro? 3: Is there a way to only let data be written to a spreadsheet via a user form? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Getting open file's directory, captureing user login ID, write access
1. ActiveWorkbook.Path
2. Here is a simple function that returns the network user id Public Declare Function GetUserName Lib "advapi32.dll" _ Alias "GetUserNameA" _ (ByVal lpBuffer As String, _ nSize As Long) As Long Public Function UserName() As String Dim sName As String * 256 Dim cChars As Long cChars = 256 If GetUserName(sName, cChars) Then UserName = Left$(sName, cChars - 1) End If End Function 3. Probably need to protect it, and remove the protection when you want to write to it, then re-apply it. -- HTH RP (remove nothere from the email address if mailing direct) "Claud Balls" wrote in message ... I have a few questions. 1: How can I get the directory for the currently opened excel file? 2: Is there a way to capture the login ID for the user currently using the excel macro? 3: Is there a way to only let data be written to a spreadsheet via a user form? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Getting open file's directory, captureing user login ID, write access
I just tried out your first two suggestions, EXCELLENT HELP!! thank you
and Merry Christmas. I have yet to deal with #3. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 03:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com