Microsoft KB Archive/52180

{| = Excel: Error at Macro Cell Containing FOPEN Command =
 * width="100%"|

Last reviewed: November 2, 1994

Article ID: Q52180

SUMMARY
The FOPEN command function is designed to allow you to open a text file from a macro. If you try to run the FOPEN macro a second time, you will receive a &quot;Macro error at cell...&quot; error message. This is because the macro is unable to open a file that has already been opened using the FOPEN command.

Once a file has been opened by the FOPEN command, you can read and edit characters from the file. When finished, the file should be closed using the FCLOSE command. The following lines print the characters on the screen and then close the text file again:

A  1   =FOPEN(&quot;Worksheet1&quot;,1) 2  =FREAD(A1,5) 3  =ALERT(A2,2) 4  =CLOSE(A1) 5  =RETURN

MORE INFORMATION
For more information on FOPEN, FCLOSE, and all the other F-commands, see pages 73 and 78-79 in the &quot;Microsoft Excel Function Reference&quot; version 3.0 manual. If you are using Excel 2.20, see pages 219 and 229-231 in the &quot;Microsoft Excel Functions and Macros&quot; version 2.2 manual.
 * }