+ Reply to Thread
Results 1 to 6 of 6

dir function is not working on colleagues PC

Hybrid View

  1. #1
    Registered User
    Join Date
    05-12-2022
    Location
    Neuss, Germany
    MS-Off Ver
    2019
    Posts
    6

    dir function is not working on colleagues PC

    Hi,

    I am trying to import a csv sheet on a daily basis. The sheet is named after the exact timestamp when it was created. The seconds are changing everyday thats why I need the "Dir" function to complete its name. On my PC (using Excel 2019) the code works fine but when my collegue, who is using Excel 2019, too, is trying to run the code, it always crashes when looking up the filename.

    Is there any library he needs to import to VBA so he can run the function? Are there any other mistakes we are making?

    Thanks in advance!

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: dir function is not working on colleagues PC

    All the basic libraries are loaded by default, certainly if you're using the VBA DIR command. Any error message?

    As a check, you can use the Tools/References menu in the VBA editor to check for anything listed as 'MISSING'.

    And define 'crash' - an error message?, Excel closes? Blue screen of Death ...???

  3. #3
    Registered User
    Join Date
    05-12-2022
    Location
    Neuss, Germany
    MS-Off Ver
    2019
    Posts
    6

    Re: dir function is not working on colleagues PC

    The error message is basicly that the name he is looking for cannot be found within the given path.
    It just stops the macro; no blue screens, no excel closings.

    The code is the following:
    Sub whsopss()
    '
    ' whsopss Makro
    '
    Dim path As String
    Dim path_drei As String
    Dim Datum As Long
    Dim timestamp As String
    
    'datumsabhängigen whsops Name in Variablen Name einlesen
    
    Datum = Format(Date, "YYYYMMDD")
    path = "T:\Reports\Rueckstand\"
    timestamp = Dir(path & "whsopsstatus_" & Datum & "*.csv*")
    path = path & timestamp

  4. #4
    Valued Forum Contributor
    Join Date
    05-03-2022
    Location
    Halifax,Canada
    MS-Off Ver
    365
    Posts
    326

    Re: dir function is not working on colleagues PC

    Some of the staff in our office have a different drive share letter (e.g. "T") ... have you gone to your peers computer and checked that he/she has the exact path and file ?

  5. #5
    Registered User
    Join Date
    05-12-2022
    Location
    Neuss, Germany
    MS-Off Ver
    2019
    Posts
    6

    Re: dir function is not working on colleagues PC

    Thats a very good point since we have some weird letters in the german language like "ü" which is included in the file path and could be spelled like "ue". I will look into it tomorrow since he has already left the office.
    Thanks!

  6. #6
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: dir function is not working on colleagues PC

    Instead of using drive letter for your path... try using UNC path.
    "T:\Reports\Rueckstand\"
    Ex:
    I have network drive z:\ (Media) mapped on my environment. But UNC path is \\ServerName\Media\Media

    If you don't know the UNC path. You can use cmd.exe and run 'net use' command to find which drive letter corresponds to which UNC path.

    EDIT: When using 'net use' command. Make sure to run it as specific user that is needed for. As drive mapping is specific to user context. For this reason, I used to use GPO logon script to ensure consistent mapping of network drives across all users based on role.
    Last edited by CK76; 05-12-2022 at 11:08 AM.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

+ 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. All our American colleagues.....
    By pjwhitfield in forum The Water Cooler
    Replies: 77
    Last Post: 11-26-2016, 01:45 PM
  2. Hello my colleagues :)
    By matinha052 in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 10-25-2016, 05:46 AM
  3. Accrual rate for colleagues
    By Jellybean503 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-14-2016, 10:02 PM
  4. [SOLVED] Code won't run on colleagues PC
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-26-2014, 07:15 AM
  5. My CF is not working on my colleagues PC
    By RDyman in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-30-2014, 06:22 AM
  6. Using Add ins to share macros with colleagues
    By zestygirl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2010, 12:17 PM
  7. Automatic Calculation:my colleagues
    By kendo2748 in forum Excel General
    Replies: 1
    Last Post: 06-23-2009, 05:33 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