Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default getting a list of users with permissions to a workbook

I have a workbook on a shared exchange folder, and I want to create a list
of all of those users in a new sheet.

Can I do this?

TIA


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default getting a list of users with permissions to a workbook

Tough question, I did find these tools on the net. I'm not really sure
how excel can use them, but I'm trying to figure it out.
Download:
http://www.microsoft.com/ntserver/nt...25/default.asp

Directions: http://www.serverwatch.com/tutorials...le.php/1476741



*** 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 a list of users with permissions to a workbook

I got this to work, but it took some tweaking. First make sure to
download the ADSI resource kit from the link I posted. Copy the script
and paste it into a file, save the file with a .vbs extension. I name
my file Check_Perms.vbs.

Paste the following at the bottom of the .vbs file, and make sure to
correct lines that have been cut off.

Sub WriteToLog(Message, sTarget) ' Creating and writing to a text file
Dim fLog, Fso
Set Fso = CreateObject("Scripting.FileSystemObject")
' Create the log file if it does not exist
If not Fso.FileExists(sTarget & ".txt") Then
Set fLog = Fso.CreateTextFile(sTarget & ".txt", True)
fLog.Close
End If
' Append to the log file
Set fLog = Fso.OpenTextFile(sTarget & ".txt", 8)
fLog.WriteLine(Message)
fLog.Close
End Sub

Then replace the wscript.echo commands with a command calling the sub I
just gave you. Example:
WriteToLog sMsg & "ADS_ACEFLAG_UNKNOWN", sTarget

Now in your Excel sheet use:
Private Sub Workbook_Open()
Dim strTextFilePath As String
strTextFilePath = ActiveWorkbook.FullName & ".txt"
'Creates temporary permissions text file
'Correct the .vbs path name in the shell command
Shell ("cscript //nologo H:\Excel\WritePerms.vbs ACTION=SHOW
TARGET=" & ActiveWorkbook.FullName)

While Dir(strTextFilePath) = ""
'Waits for file to be created
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
Wend

'Imports permissions text file
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & strTextFilePath, Destination:=Range("A1"))
.SaveData = True
.AdjustColumnWidth = True
.TextFilePlatform = xlWindows
.TextFileStartRow = 2
.TextFileParseType = xlFixedWidth
.TextFileColumnDataTypes = Array(1, 1)
.TextFileFixedColumnWidths = Array(20)
.Refresh BackgroundQuery:=False
End With

'Deletes temporary file
Kill strTextFilePath
End Sub

Let me know if it works for you.

*** 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
Log of users who open the workbook txheart Excel Discussion (Misc queries) 0 April 21st 10 03:14 PM
Shared Workbook & permissions jk New Users to Excel 1 September 21st 06 12:32 PM
Workbook Permissions - How to Control? Karl Burrows Excel Discussion (Misc queries) 3 June 4th 05 04:55 PM
Setting Up Workbook Permissions Phil Hageman[_3_] Excel Programming 3 May 25th 04 09:01 PM
Users on a Shared workbook gr8guy Excel Programming 2 May 9th 04 12:46 AM


All times are GMT +1. The time now is 09:44 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"