Hello,
How do I get the current working directory of the exe file. Like when I lunch the open dialog box it enters the current directory, I need to know what it is...
Thank you all, you made my life easier for so many times.
FatMan
Printable View
Hello,
How do I get the current working directory of the exe file. Like when I lunch the open dialog box it enters the current directory, I need to know what it is...
Thank you all, you made my life easier for so many times.
FatMan
You could use App.Path which gives you the directory which the exe is in afaik.
The GetCurrentDirectory API function returns the current working cirectory of the currens process (application). I think that's what you need.
'in a module
public Declare Function GetCurrentDirectory Lib "kernel32" Alias "GetCurrentDirectory" (byval nBufferLength as Long, byval lpBuffer as string) as Long
'in your code
Dim sTemp as string
sTemp = Space$(255)
GetCurrentDirectory(255,sTemp)
sTemp = Left(sTemp, InStr(1,sTemp,vbNullChar)-1)
I hope that answers your question
The VB CurDir function gives the current directory. ChDir changes the current directory.