Solved

open file Error

Posted on 1998-06-11
1
154 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
ID: 1463169
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

776 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