View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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!