tags:

views:

2679

answers:

2

Open App.Path & "\Folder\" & str(0) For Output

Seems to get a path not found however if directly before that I do

MsgBox App.Path & "\Folder\" & str(0)

It Provides the correct directory/filename that I want

and if I replace that string with the direct path in quotes it works fine however that won't be very good for other users of my app :( Anyone know why this doesn't work?

A: 

You can open a file that doesn't exist. I tried it with:

  Open "c:\temp\test.txt" & Str(0) For Output As #1
  Close #1

When it ran it created c:\temp\test.txt 0

Note that I added "As #1" to the Open statement, and taht Str(0) adds a leading space for the optional minus sign (CStr(0) doens't add a leading space)

GregUzelac
A: 

Comment: You can open a file that doesn't exist.

Only true if your folder exist. If both your folder and file does not exist, it will give a "path not found" error.