-
Help,Thank You, and Happy Holidays!
What's wrong with this code? I get a "path not found" error used within form and "invalid outside procedure" error when used in module. I can't remember how to do this. I'm using this part of a code found here that was edited by "Kieko":
Type Record
FirstDate As Date
MaxDate As Date
Count As Integer
End Type
Dim rec As Record
Dim strFile As String
Dim blnSuccess As Boolean
blnSuccess = False
strFile = "c:\windows\desktop\rnd\a.txt"
If (Dir(strFile) = "") Then
'not found then create a new one
Open strFile For Random As #1 Len = Len(rec)
rec.Count = 0
rec.FirstDate = Date
rec.MaxDate = Date
Put #1, , rec
blnSuccess = True
Close #1
Can anyone help me?
Have a great new year even if you can't,thank you!
JoeyO
-
You get "Path Not Found" because you do not have a folder called 'RND' on your desktop. Add some code to check for the existence of this folder, and create it if it does not.
HTH
Tom
-
Clunietp:
Thats the point. I need to know how to create it. Is there a command like:
Create.NewFile = "C:\MyNewFile"? I feel like an idiot because I know I did it before but I've got no refrence books with me. Can anyone help me out?
-
here ya go Joey:
Code:
If Dir("C:\TEST", vbDirectory) = "" Then
MkDir ("C:\TEST")
Else
MsgBox "Test already exists!"
End If
'save file here, the directory exists
Tom
-
Thanks Again You guys are awsome!