|
-
Aug 25th, 2000, 09:15 AM
#1
Thread Starter
Addicted Member
Hi guys
I'm just wondering can anyone tell me how to open a file in a current directory,
eg,
code/
[Open "Current Directory\text.txt for Append as #1. ]
I'm creating a file and I want it to be created in the same directory that as the application is run from. I heard something about "cardir", but I'm not to sure, Can anyone help???
[Edited by kanejone on 08-25-2000 at 10:18 AM]
-
Aug 25th, 2000, 09:18 AM
#2
Fanatic Member
Kurt Simons
[I know I'm a hack but my clients don't!]
-
Aug 25th, 2000, 09:22 AM
#3
Guru
That's not CarDir, it's CurDir. 
First:
Code:
Function AddSlash(ByVal sPath As String) As String
AddSlash = sPath & IIf(Right(sPath, 1) = "\", vbNullString, "\")
End Function
Then:
Code:
' If you want to open the file from the CURRENT directory:
Open AddSlash(CurDir) & "text.txt" For Append As #1
' If you want to open the file from the APPLICATION'S directory:
Open AddSlash(App.Path) & "text.txt" For Append As #1
-
Aug 25th, 2000, 09:26 AM
#4
Thread Starter
Addicted Member
Thanks a lot
That was exactly what I needed,
Take care
JK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|