It comes in handy for getting files. If you stick your file in the same location as your project then you can easily access it.
VB Code:
sFileLocation = App.Path & "\File.txt"
Thats assuming your file isn't on the root of a drive, C: A:
VB Code:
Option Explicit
Dim Ap As String
Sub Form_Load()
If Right$(App.Path, 1) = "\" Then
Ap = App.Path
Else
Ap = App.Path & "\"
End If
End If
Private Sub cmdSave_Click()
Open Ap & "Yourfile.txt" For OutPut As #1
'Save data
Close #1
End If
That way you don't have to think about the / if its needed or not. That way the exe can be anywhere you want it to be.
Last edited by Keithuk; Jan 6th, 2006 at 07:52 PM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.