Excel: Running FLATFILE.XLA from a User-Defined Macro

ID: Q78308


The information in this article applies to:
  • Microsoft Excel for Windows, versions 3.0, 4.0, 4.0a


SUMMARY

In Microsoft Excel, the FLATFILE.XLA add-in file supplies a macro that allows you to import data from a text file to a worksheet, and a second macro that allows you to export data from a worksheet to a text file. Normally these features are accessed from menu options that the add-in supplies. To run the data export macro from within a user-defined macro sheet, you must make a slight modification.


MORE INFORMATION

To execute the Data Export command from a user-defined macro, the following formula is used:

=FLATFILE.XLA!MCP01.FixedFieldExport()
To execute the Data Smart Parse command from a user-defined macro, the following formula is used:
=FLATFILE.XLA!MCP05.SmartParse()
If you attempt to export data from a spreadsheet to a file by calling the FLATFILE.XLA data export macro from within a user-defined macro, the user-defined macro will halt. This is because the FLATFILE.XLA data export macro ends with a HALT statement rather than a RETURN statement. The HALT command prevents the data export macro from returning control to the macro that called it.


WORKAROUND

The HALT statement is contained on a cell of FLATFILE.XLA. You can replace it with a RETURN statement. Do the following:

  1. Hold the SHIFT key down as you open FLATFILE.XLA. This makes the file available for editing. If the file is hidden, choose Unhide from the Window menu and select it from the list.


  2. Select the cell containing the HALT statement. This will be on cell B47 in version 3.0, B82 in versions 4.0 and 4.0a.




  1. Replace "=HALT()" with =RETURN().


You should make a backup of the original FLATFILE.XLA prior to making any changes.


REFERENCES

"Microsoft Excel Function Reference," version 4.0, pages 216, 363

"Microsoft Excel Function Reference," version 3.0, pages 120, 200

"Microsoft Excel User's Guide 2," version 4.0, pages 151, 152, 199

"Microsoft Excel User's Guide," version 3.0, page 683-684

Additional query words: 3.0 4.0 4.00a

Keywords :
Version : WINDOWS:3.0,4.0,4.0a
Platform : WINDOWS
Issue type :


Last Reviewed: October 14, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.