workspace.OpenFileDialog deletes empty files

I’m using the following:

Dim file as Variant

file = workspace.OpenFileDialog(False­, “Open File”,"C:")

If the user chooses a 0 byte file (empty file) in the file dialog, the file is deleted. I doubt this is the intended behavior.

This later causes a problem, since I pass the file name to the following:

fileNum = Freefile()

Open filename For Input As fileNum

Do While Not Eof(fileNum)

which generates an error, since the file is now gone.

Is this problem addressed anywhere? I couldn’t find anything about it. If not, any clever workarounds? I need the file to be present, even if the file is empty. Thanks.

Subject: workspace.OpenFileDialog deletes empty files

I’ve had the same problem, and I don’t know of any workaround I’m afraid. The only thing I can think of is putting in a check immediately after OpenFileDialog to see if the selected file exists, and if it doesn’t, recreate a blank file.