Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Guess this is a typo
Loop Until fs.fileexists("D:\test.txt") should read Loop Until fs.fileexists("C:\test.txt") If doing this in Vista or W7 probably won't be able to save to the root, try somehting like sFile = application.defaultfilepath & "\userinfo.txt" Regards, Peter T "Gary Keramidas" wrote in message ... one other thing i forgot to mention, it uses the D Drive, if you don't have one, here's one that will work with the C Drive Sub test2() 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") & " C:\test.txt") Do Loop Until fs.fileexists("D:\test.txt") Open "C:\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 "C:\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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel to Lock Windows User Account? | Excel Programming | |||
Using macros in a second user account | Excel Discussion (Misc queries) | |||
i share my copmuter. how can i setup seperate new user account | New Users to Excel | |||
Can a service account be embedded in Workbook so that by default the macros are run with service account credentials and not the user credentials??? | Excel Discussion (Misc queries) | |||
Getting Windows user (Account) from a VBA routine | Excel Programming |