Run time error 76. Path not found

  • Hello everyone

    I have this application which is working fine in almost all the different systems I worked. But today, I went to a new office and tried to run the application and I faced this issue "Run time error 76. Path not found". I need your expertise to help me to correct this issue. My path in the code is as below:

    Code
        strTempFile = "C:\Users\" & Environ("username") & "\Desktop\Bank.xml"

    FYI, The code creates an xml file and saves it on the desktop.

    • Best Answer

    Hello,


    If you are totally sure about the User Name spelling ... and the actual existence of the whole path ...


    you can try Environ$ ...


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • I altered Environ to Environ$ and in my system and it worked without error. Have to check the same in the office I tested today. Thanks Carim. Will revert back as soon as I check in that office system.

  • Thanks for your Thanks ... AND for the Like :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Pleased to see you could fix your problem :)

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Pleased to see you could fix your problem :)

    Actually. the fault was in the path. The system was connected to a server and was not saving the file on the desktop. I created a new folder on the desktop and replaced the old path with the new and I got it right. I also included $ in the code as you suggested. :)

  • Fine ...


    At least, this question has allowed you to hear about using the $ sign to declare a function as a String ... which has the advantage to be a lot less greedy in terms of memory ... :)


    Dollar Sign in VBA Functions

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!