|
-
October 22nd, 2001, 02:09 PM
#1
Saving Problem
When I run the following code, it tries to write to files which aren't folders. I only want it to save the file in the folders under that directory. Help would be appreciated.
_____________________
option Explicit
private Sub Command1_Click()
Dim strFolder as string
Dim strtPoint as string
strtPoint = "C:\My Documents"
strFolder = Dir(strtPoint & "\*.*", vbDirectory)
Do
If strFolder <> "." And strFolder <> ".." then ' bypass system folders
If GetAttr(strtPoint & "\" & strFolder) And vbDirectory = vbDirectory then ' This a Directory
Open strtPoint & "\" & strFolder & "\title.txt" for Output as #1
print #1, "Message"
Close #1
End If
End If
strFolder = Dir ' get next in chain
Loop Until strFolder = "" ' do it again
End Sub
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
|