Solved

open file Error

Posted on 1998-06-11
1
151 Views
Last Modified: 2010-05-03
When i do the following , VB gave me a path not found message (highlighting line 2) Why ?
open "c:\windows\temp\file1.text" for Input as #1
open "c:\windows\temp\file2.text" for Input as #2
Data = "Myname"
Put #1 Data
0
Comment
Question by:kwl
1 Comment
 
LVL 4

Accepted Solution

by:
yowkee earned 100 total points
Comment Utility
kwl,

  What it really means is the file "c:\windows\temp\file2.text" is not existed! Open statement will create file for non-existed file path *only* for Append, Binary, Output, or Random modes.

  Besides, it is better to use the FreeFile function to obtain the next available file number.

eg.  Dim iFile as Integer
     iFile = FreeFile
     Open "C:\temp\test.txt" for output As #iFile

Regards.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now