Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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!
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
Open Specific Form by User Login Bowtie63 Excel Discussion (Misc queries) 1 November 30th 07 12:21 AM
Unshared workbook allowing write access to more than 1 user [email protected] Excel Discussion (Misc queries) 0 August 2nd 06 03:14 PM
Login and logoff to active directory by VBA learn Excel Discussion (Misc queries) 0 March 23rd 06 09:29 AM
Is this right (open for write access) John Pritchard Excel Programming 0 September 21st 04 04:50 PM
How to get file's current directory path to a string in VBA? [email protected] Excel Programming 1 October 16th 03 07:41 AM


All times are GMT +1. The time now is 01:15 AM.

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

About Us

"It's about Microsoft Excel"