Automatically detection of install-directory
I am making a program with some statistics. One of them show you the last time you accessed the program. This is my code:
___________________________________________
Dim FileSystemObject, FileObject As Object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set FileObject = FileSystemObject.GetFile("C:\Program files\program.exe")
Set FileSystemObject = CreateObject
Text1.Text = vbCrLf & "Last accessed: " & _
FileObject.DateLastAccessed & vbCrLf
_____________________________________________
The thing really, is that I have no guarantee for that the user will put the file in this directory. How do I make the program find the directory itself?
Thank you!:)
Re: Automatically detection of install-directory
Quote:
Originally posted by Mutuz
I am making a program with some statistics. One of them show you the last time you accessed the program. This is my code:
___________________________________________
Dim FileSystemObject, FileObject As Object
Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
Set FileObject = FileSystemObject.GetFile("C:\Program files\program.exe")
Set FileSystemObject = CreateObject
Text1.Text = vbCrLf & "Last accessed: " & _
FileObject.DateLastAccessed & vbCrLf
_____________________________________________
The thing really, is that I have no guarantee for that the user will put the file in this directory. How do I make the program find the directory itself?
Thank you!:)
use app.path
that will return the directory the exe is located in... but that only works in the exe itself... is this how you are doing it? because if it is.. then wouldn't the return value always be that day since they need to open the program to view the stat?