1

I an trying to get my running file name in VB6.

If I were in python3+ I can simply run the script below called "temp.py" and it returns my current running script name. I want the same thing but in VB6 but have only been able to return the path with CurDir(). Extension of file will have to be ".bas"

import os

print(os. path. basename(__file__))

temp.py

I have tried search various stack overflow but cannot find the same issue. Microsoft documentation cannot help either

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Ryan
  • 31
  • 2
  • Debug.Print App.EXEName if you're in the IDE or just access it as App.EXEName in a compiled program. – John Eason Apr 17 '23 at 13:53
  • If you want the executable its what John wrote or https://stackoverflow.com/questions/12423824/how-to-get-the-full-path-of-the-current-executable-file-in-vb – StayOnTarget Apr 17 '23 at 13:55
  • 1
    To clarify my comment above, and as a ".bas" file extension is mentioned in the original question, a running Vb6 program has no concept of the name of the "module" (.bas, .frm, etc.) that it's current code is running in so that part of the question is meaningless. – John Eason Apr 17 '23 at 14:33
  • 1
    https://stackoverflow.com/questions/2632106/how-do-i-access-the-names-of-vb6-modules-from-code – User51 Apr 17 '23 at 15:06
  • If you really need the current source file name rather than the executable's name: VB doesn't povide this. See the link of @User51 for a manual workaround instead. – Hel O'Ween Apr 19 '23 at 13:21

0 Answers0