Microsoft KB Archive/52180

From BetaArchive Wiki

Excel: Error at Macro Cell Containing FOPEN Command

Last reviewed: November 2, 1994
Article ID: Q52180


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 "Macro error at cell..." 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:

   1   =FOPEN("Worksheet1",1)
   2   =FREAD(A1,5)
   3   =ALERT(A2,2)
   4   =CLOSE(A1)
   5   =RETURN()


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

KBCategory: kbother


Additional reference words: 2.20 3.00

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.