Access system-environment variables

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.


3/31/2006 7:40:56 AM
excel 39879 articles. 2 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 49

dim s as String
s = environ("username")


"Perry" <> a �crit dans le message de
> 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

ardus.petus (319)
3/31/2006 7:50:56 AM
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.


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
    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:


normanjones (1047)
3/31/2006 8:03:51 AM
Perfect.  Thanks Norman & AP

3/31/2006 11:20:29 AM

Similar Artilces:

Terminal Server in SBS 2008 environment not issued any license
Hello, We have problems with a Terminal Server in a SBS 2008 Premium environment. Our network is as following configured: the first server is the SBS 2008 server, our second server is a Windows Server 2008, with Terminal Server activated. We have use the following manual: On the Terminal Server would the TS-license server not issued open Windows Server 2008 Users CAL's, so we cannot external login. On only one computer we can login. The license are correct activated. The license controle don't find any ...

access to the m drive as a admin
how can i get access to the m drive mbx folder from the mailboxes i'm login as administrator i want to change somthing on de m drive please help "rene" <> wrote: >how can i get access to the m drive mbx folder from the >mailboxes >i'm login as administrator >i want to change somthing on de m drive >please help Don't even consider accessing the M drive as an admin to look in mailboxes. That's a recipie for disaster. Gain administrative accesses to mailboxes by this method:

Access 2007 File Size Limit?
Does anyone know if Access 2007 has the same 2 GB file size limit that Access 2003 has? Thanks, -Joe -- Posted via a free Usenet account from Hi, Joe. > Does anyone know if Access 2007 has the same 2 GB file size limit that > Access 2003 has? Yes. It's 2 GB max. HTH. Gunny See for all your database needs. See for Microsoft Access tips and tutorials. Blogs:, for contact info. ...

Change cell color based on variable condition
I have a large table with 5 data columns and a sum column: A B C D E F 1 2 2 2 2 2 10 2 2 8 2 2 2 16 3 1 1 6 1 1 10 4 1 2 1 2 8 14 5 1 2 3 4 5 15 The actual data is much larger (1E10). I would like to change the color of each cell that meets some criteria, such as it is >= 50% of the sum (F). In the table above, that is true for B2, C3, & E4. So I;d like to turn those cells yellow and leave the other unchanged. I would also like to be able to change the formula in one place and have all cells recalculate. Failing that, I'd like to be able...

accessing 'dl-mem-submit-perms' in Exchange 5.5 GAL
can anyone offer advice on how I can get at the 'dl-mem-submit-perms' attribute for a group? I have no problem getting 'auth-orig' or any of the attributes.. running the script below never finds 'dl-mem-submit-perms' although I can see it use the Exchange Admin Tool I cannot see it with ldp :-( Thanks Wayne sKey = "dlistname" sServer = "servername" sUserName = "cn=admin,dc=domain,cn=admin" sPassword = "password" Set oConnect = CreateObject("ADODB.Connection") oConnect.Provider = "ADsDSOObject" oConn...

Possible to export .pst contents to my local file system?
I would like to export the contents of my .pst file to my local file system. So in Outlook I may have some folders/files like the following; "Personal Folders\stuff\msg1" "Personal Folders\stuff\msg2" "Personal Folders\stuff\msg3" .... I would like to export this so I would have the following (or something similar) on my local file system; "c:\Personal Folders\stuff\msg1.html" "c:\Personal Folders\stuff\msg2.html" "c:\Personal Folders\stuff\msg3.html" .... Is there any way of doing this? Thank you. ...

Choosing fields for system integration
I have a question on system integration on selecting "Unused" fields for storing data. Our system for entering tasks, billing, and tracking status on projects has fields that would be nice to have in the Great Plains system. Like the last 4 digits of the phone number or the gps coordinates of an office. Should these types of additions be done in a new table or is the recommended way to piggyback on an existing field that is not currently being used? What are the issues that we might face on future upgrades with either adding new fields or using "unused fields"? As...

Variables in URL formula help
Can anyone help me solve a simple but annoying problem? I have a formula that links to a URL =' Apr 2007/[results.xls]results'!$D$2 which gives back the value 3 (as it should) Now I want to draw 18 Apr 2007 from a cell value found in an open file called reference.xls. So I tried ="'" &'[reference.xls]sheet1'!$A$53 &"/[results.xls]results'!$D$2" but it just shows the words ' Apr 2007/[results.xls]results'!$D$2 instead of the value Can anyone tell me the rig...

Outlook Web Access not operation after disasterrecovery
Replaced and exchange 2003 box (followed MS article - downed the old server, brought new one online with same, name, ran setup /disaterrecovery, restored the databases from backup, mounted IS, installed service packs). Everything's fine after quite a few messes regarding Exchange 5.5 connectors still in ADSI, which took some work to clear out. Now event logs are completely clean, not even warnings showing. However, somewhere in the process, Outlook Web Access isn't operational. I've checked permissions on all folders (per MS' knowledgebase articles), ensured IIS is ope...

Image problem after Access 03 re-install
Good day, I just had to un-install and re-install Access 03 because I installed SP3 which caused havoc. Now, when I start any database, I get the following error: Microsoft Office Access doesn't support the format of the file 'L:\Downtown\Loan_Operations\Loan_Ops\SupportFiles\GBTBlue.png,' or file is too large. Try converting the file to BMP or GIF format. This was working just fine before the uninstall and reinstall. Help please??? Thank you. ...

Exchange 2003 web access questions
Hi there: We've recently added an Exchange 2003 server into our network, while leaving the original Exchange 2000 server up and running with a few mailboxes on it. I'm currently having a problem completing the transition to 2003 because some old code doesn't seem to work anymore. We have implemented a very limited email interface for our factory workers, so that they can only send email to approved addresses, and all emails are CC'd to supervisors. I wrote this interface a couple of years ago in ASP, and it does every thing we need. If we try to copy this interface over to t...

Quick Access Toolbar
how do I delete an item from the quick access toolbar ? Right click it and see the options available. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site Word MVP web site <>>< ><<> ><<> <>>< ><<> <>>< <>><<> "Pancho Villa" <Pancho> wrote in message news:E64C8572-2C2A-4DC6-A9E5-32A9B3E193E1...

tableadapter Query linked to Access 2003 table
I'm trying to write a query for my Dataset's table adapter. It is linked to an access 2003 database. Basically, I'm trying to duplicate the following query. SELECT Parts_Inventory.Aisle, Parts_Inventory.Rack, Parts_Inventory.Shelf, Parts_Inventory.QNTY, Parts_Inventory.MFG_PN, Parts_Inventory.Manufacturer, Parts_Inventory.Description FROM Parts_Inventory WHERE (((Parts_Inventory.Manufacturer) Like "*" & [?] & "*")); I'm using a text box as my control to the manufacturer field. If it is blank, it will show all my parts. I'm able...

CRM 3.0 Pro on a member server within a SBS2003 environment. supported? works?
can CRM3.0 Pro (not SBE) be installed on a SBS2003 environment on a member server (not the SBE server)? Yes, I've had that setup for some time with no issues... "IGA" wrote: > can CRM3.0 Pro (not SBE) be installed on a SBS2003 environment on a > member server (not the SBE server)? > > But is it supported by Microsoft. "James Sanford" wrote: > Yes, I've had that setup for some time with no issues... > > "IGA" wrote: > > > can CRM3.0 Pro (not SBE) be installed on a SBS2003 environment on a > > member server (n...

Finding the biggest number out of 8 variables
Hi All Does anybody know of an easy way to find out which variable has the highest value out of 8 variables? For example, I have these values in 8 vars: 3 0 7 30 37 17 0 7 Although from a human's perspective it's easy to see that the 5th var has the highest value, how can I chose the appriopriate var programmatically? Thanks There are many solutions. You could put the values into an array and pass the array to a QuickSort routine. The QuickSort algorithm is difficult to understand, but you really don't need to know how it works. See: http://vbnet.mvp...

Block Money 2006 from accessing websites
I would like to be able to block Money 2006 from accessing at all times. It is a pain to have to wait fo it to play games accessing when I start it. They only website I want it to access is when I authorize a payment. I don't want to kill my internet connection everytime I statrt Money. I tried blocking access to moneycentral in the hosts file, but it accesses anyways. Please advise. Thanks in advance. I'd try creating a HOSTS file which points to For XP, that files is in your \Windows\System32\Drivers\etc fold...

Access violation #2
I get an access violation when running the PostThreadMessage in the code below: void CXXXDlg::OnListenButton() { if(m_ThreadRecvSocket == 0) return; m_ThreadRecvSocket->PostThreadMessage(WM_CLOSE_SOCKET, 0, 0); } This however works just fine, BOOL CXXXDlg::OnInitDialog() { // code m_ThreadRecvSocket->PostThreadMessage(WM_CLOSE_SOCKET, 0, 0); return true; } So why do I get an access violation in OnInitDialog and not on OnListenButton ? "John Nash" <laasunde@<remove>> wrote: >I get an access violation when running the PostThreadMess...

No Mouse
I have drop down boxes in my excel spreadsheet which are used to select an employee to work a certain shift. Is there a way to access the drop down box without clicking on it with a mouse. Thanks Jay D. -- jayd77 ------------------------------------------------------------------------ jayd77's Profile: View this thread: Hi, use the ALT + DOWN arrow key HTH J -- pinmaste ----------------------------------------------------------------------- pinma...

Access Runtime 2000 prevents office updates
Hi, I have a strange problem that's been bothering me for a long time. I've finally gotten it narrowed down, but can't find anything else about this on the web. I'm using an application that uses Access Runtime 2000 (developed by someone else.) After I install this application, I can no longer use Office Updates. It'll get to about the 88% mark, then gives me the "Office update is unable to check for updates" screen. If I use "add/remove programs" and remove the Runtime 2000 environment, the updater works just fine. Any thoughts on how I can fix the en...

Slow USB drive access
I recently upgraded from 32-bit Vista Ultimate to 64-bit 7 Pro. Under Vista, I had no problems access an external 300gig USB drive with thousands of files. Now, every time I access that drive (even just opening explorer) it has to reindiex, or something that takes it several minutes to finish before I can read any files. What's goling on? What do I have to do to stop this? In the Technet Win 7 Forums the USB problem has been discussed and the problem is mostly associated with certain Intel chipsets and nVidia chipsets.

Email router 4.0 Outgoing (test access failed)
Hi Can anybody help me email router 4.0 Outgoing. I get the below error when i try to test access but i am able to load the data. Outgoing Status: Failure - An error occurred while checking the connection to the Microsoft Dynamics CRM server https://mscrmqa12/MSCRMQA12. The selected Microsoft Dynamics CRM account cannot be authenticated. Please make sure the selected account is a valid account for the specified Microsoft Dynamics CRM organization, or has permission to impersonate other users. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure ...

Pass table data from Access to a C dll and get it back
Hi, I want to pass a table's data into C code for further processing and get the processed data back into another table in Access. I have seen sample code in C++ opening an Access db and using automation on it. However, this is not permitted in my case; the driver application has to be Access itself. So maybe I have to pass the data into VBA and then further into the C code? Sample code for this anyone? Just a simple table with a few columns (properties) will do. TIA, Nikolas "rdrnws" <> wrote in message news:fh9nfp$rpo$ > Hi, I want to ...

Allow R/W access to usb, cd and floppy, but not c drive
Hi- First, I hope GP General Discussions stands for Group Policy.... I am a public librarian, and manage a small facility with public access computers. I have worked with a tech support person to set up a group policy for a population of users (the "public") who can browse the Internet and use specific applications, but they cannot save anything to the C drive. I want to allow them to read from and write to the usb, cd and floppy drives so they can upload their resume from a cd onto Monster, for example. I got this idea from reading about the MS Shared Computer Toolkit, but we...

Duplication of Production CRM Install to Test environment
I was wondering if anyone had duplicated a Production CRM Install to a test environment to verify a 1.0 to 1.2 upgrade. We have to minimize down time and want to do a rehersal before we do it live (we have some customizations that may cause problems). I have not seen any procedures/recommendations that address this. Any recommendations? Thanks for the help in advance. We have used VMware in the past to do test/production environments. Bill >-----Original Message----- >I was wondering if anyone had duplicated a Production CRM >Install to a test environment to verify a 1....

Use Same Variable multiple times in a query with different criteri
ok i have this variable i am trying to use twice with different criteria and it doesnt work help after i do with i want to count them November: Date_mailed (Variable Name) tblRecruitment2 (Table name) Between #11/1/2009# And #11/30/2009# (Criteria) October: Date_mailed tblRecruitment2 Between #10/1/2009# And #10/31/2009# I think you want to count? If so, set the E looking button on your tool bar, which turns on the Group ON feature then change the Group On to count. -- Milton Purdy ACCESS State of Arkansas "BZboarding101" wrote: ...