Search code examples
vbaexcelex

Running .exe directly & through Shell VBA returning different results


When I click directly in the .exe file "PrintUsers.exe", the output is correct. But when I do that through VBA using Shell the result is different. It tries to find the text file in another directory. Why? See figure:

figure

SOLUTION: I am now using: GetModuleFileName(NULL, szEXEPath, 2048) instead of GetCurrentDir(buff, FILENAME_MAX);


Solution

  • SOLUTION: I am now using: GetModuleFileName(NULL, szEXEPath, 2048) instead of GetCurrentDir(buff, FILENAME_MAX);