+ Reply to Thread
Results 1 to 7 of 7

Environ("TMPDIR") returns empty string

  1. #1
    Registered User
    Join Date
    01-10-2020
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    3

    Environ("TMPDIR") returns empty string

    Hi,

    I used the following to get a location to be used for temp files

    strP = environ("TMPDIR")

    unfortunately I get back an empty string only. If I use the variable "TMP" instead of "TMPDIR" it works find. The different between both are the used separator between the several directories.
    TMPDIR: c:/DirA/DirB
    and
    TMP: c:\DirA\DirB

    Does someone know why it is not working with "/". Within the description of Environ I couldn't found any restrictions

    Thanks in advance

    Regards
    asiguld

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Environ("TMPDIR") returns empty string

    Do you actually have an environment variable called TMPDIR?
    Rory

  3. #3
    Registered User
    Join Date
    01-10-2020
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    3

    Re: Environ("TMPDIR") returns empty string

    Yes, both variables do exists
    2021-10-01 11_52_23-Eingabeaufforderung.png
    Last edited by asiguld1; 10-01-2021 at 05:55 AM.

  4. #4
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Environ("TMPDIR") returns empty string

    asiguld1, referring to rorya's statement, check the results in the Immediate window:
    Please Login or Register  to view this content.
    Edit:
    It does not matter anymore

    Artik

  5. #5
    Registered User
    Join Date
    01-10-2020
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    3

    Re: Environ("TMPDIR") returns empty string

    Already done. The following may be helpful as addtional information. On my PC (German) no problem, but if the same macro is running on a laptop located in Great Britannien it doesn't. At this PC the function returns nothing even no error.
    My question is not to find a solution, I already solved it by using "TMP" instead of "TMPDIR". I want just to understand why it is how it is.
    Last edited by asiguld1; 10-01-2021 at 06:04 AM.

  6. #6
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,220

    Re: Environ("TMPDIR") returns empty string

    You have probably "manually" located the TEMPDIR environment variable on your computer. But that doesn't mean that this variable must appear on all computers. It can be added by some application that you have that is not on other computers.

    Artik

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Environ("TMPDIR") returns empty string

    When/how was the variable created? If I remember rightly, temporary environment variables are not returned by Environ.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 08-10-2015, 10:56 PM
  2. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  3. [SOLVED] Index function returns 0 (zero) instead of ""(empty)
    By deekshitulu in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-16-2014, 06:52 AM
  4. Parse first name & surname from Windows logon name (Environ("UserName")
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2013, 08:08 PM
  5. [SOLVED] IFERROR(VLOOKUP) That returns "0" when reference cell is empty
    By Sam Capricci in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 05-04-2013, 01:16 AM
  6. Difference between Environ("USERNAME") and Environ$("USERNAME")
    By ron2k_1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2011, 11:15 AM
  7. [SOLVED] For Each Next returns "Empty" when Data in Cell
    By Matt Roberts in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2005, 10:20 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1