Is there an (easy) way to access those variables displayed using the
dos "set" command from an Excel Macro
Specifically want to target username, userdomain, homedrive.
Thanks
Is there an (easy) way to access those variables displayed using the
dos "set" command from an Excel Macro
Specifically want to target username, userdomain, homedrive.
Thanks
dim s as String
s = environ("username")
HTH
--
AP
"Perry" <perrygarrod@hotmail.com> a écrit dans le message de
news:1143790856.869822.121470@e56g2000cwe.googlegroups.com...
> Is there an (easy) way to access those variables displayed using the
> dos "set" command from an Excel Macro
>
> Specifically want to target username, userdomain, homedrive.
>
> Thanks
>
Hi Perry,
> Is there an (easy) way to access those variables displayed using the
> dos "set" command from an Excel Macro
>
> Specifically want to target username, userdomain, homedrive.
Try:
'=============>>
Public Sub ListEnviron()
Dim SH As Worksheet
Dim i As Long
Dim iPos As Long
Set SH = ActiveWorkbook.Sheets.Add
With SH
.Name = "Environ List"
i = 1
While Environ(i) <> ""
iPos = InStr(Environ(i), "")
.Cells(i, "A").Value = i
.Cells(i, "B").Value = "'" & Mid(Environ(i), iPos)
i = i + 1
Wend
.Columns("B:C").AutoFit
End With
End Sub
'<<=============
If you are not familiar with macros, you may wish to visit David McRitchie's
'Getting Started With Macros And User Defined Functions' at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
---
Regards,
Norman
Perfect. Thanks Norman & AP
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks