.bat file not being created in the same directory as the excel file

  • I am working on a project for work, where i need to create a batch file, run the file, then delete it.


    The batch file looks for text files with a set name in the current folder and subfolders and combines them into one text file.


    The batch file is running correctly, but it is running from 1 directory up.


    For example, the excel file with the VBA code is here:

    G:\Dropbox\DT\WORK\Phases - 101-102-103-104-105-106-107-108-109


    But the batch file is being created here:

    G:\Dropbox\DT\WORK\



    Any help would be appreciated...


    Thanks


    Darren

  • Not sure if it was the correct way of fixing, but i just used the ChDir command at the beginning of the code..


    Code
    ChDir Application.ActiveWorkbook.Path & "\"

Participate now!

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