Thread: User Account
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_4_] Gary Keramidas[_4_] is offline
external usenet poster
 
Posts: 226
Default User Account

i cobbled this together, give it a try. it wil put the group in A1 on sheet1

Sub test()
Dim ws As Worksheet
Dim fs As Object

Dim WholeLine As String
Set fs = CreateObject("Scripting.FileSystemObject")
Set ws = Worksheets("Sheet1")
Shell ("C:\windows\system32\cmd /k net user " & Environ("username") &
" d:\test.txt")

Do
Loop Until fs.fileexists("D:\test.txt")
Open "D:\test.txt" For Input Access Read As #1

Do Until InStr(1, WholeLine, "Local Group Memberships")
Line Input #1, WholeLine
Loop
ws.Range("A1").Value = Trim(Split(WholeLine, "*")(1))
Close #1
fs.deleteFile "D:\test.txt"

End Sub


--


Gary Keramidas
Excel 2003


"ajm1949" wrote in message
...
How can I determine if a user is logged in as an Administrator or as a
standard user without Admin priveleges