Microsoft KB Archive/108356

From BetaArchive Wiki

XL5: Can't Run Macros That Use File Functions Add-in Functions

ID: Q108356



The information in this article applies to:

  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows NT, version 5.0




SUMMARY

Although Microsoft Excel version 5.0 does not include the File Functions (Filefns.xla) add-in macro (or the associated Filefns.dll file), if you install Microsoft Excel version 5.0 without deleting the earlier version of Microsoft Excel (3.0 or 4.0), the Filefns.xla add-in macro will still be available and will function normally (because the file is not deleted when you install version 5.0). However, if you do a "clean" installation of Microsoft Excel 5.0 (that is, if you delete the earlier version of Microsoft Excel before you install version 5.0), and you then run a macro that uses any of the Filefns.xla add-in functions, you will receive a macro error. Most of the file maintenance tasks that you can do with the File Functions add-in functions can be done with Visual Basic procedures.


MORE INFORMATION

The following table lists the functions that are available in the File Functions add-in macro and their Visual Basic equivalents.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

 File Functions
 Macro Command       Equivalent Visual Basic Statement
 ------------------------------------------------------------------------

 =CREATE.DIRECTORY() MkDir "MYDIR"

 =DELETE.DIRECTORY() RmDir "MYDIR"

 =DIRECTORIES()      MyDir = Dir(pathname,16)
                     ' Call repeatedly until Dir returns a zero-
                     ' length string.

 =OPEN.DIALOG()      MyDialog = Application.GetOpenFilename(fileFilter, _
                     FilterIndex,Title,buttonText)
                     ' This second form will bring up the Microsoft
                     ' Excel internal Open dialog box.
                     MyDialog2=Application.Dialogs(xlDialogOpen).Show
                     ' Will bring up default Open dialog box.

 =SAVE.DIALOG()      MyDialog=Application.GetSaveAsFilename _
                     (initialFilename,fileFilter,filterIndex,title, _
                      buttonTitle)
                     ' This second form will bring up the Microsoft
                     ' Excel internal Save As dialog box.
                     MyDialog2=Application.Dialogs(xlDialogSaveAs).Show
                     ' Will bring up default Save As dialog box.

 =FILE.EXISTS()      MyFile = Dir(pathname) 


REFERENCES

For more information about GetOpenFilename, choose the Search button in Help and type:

getopenfilename



For more information about GetSaveasFilename, choose the Search button in Help and type:

getsaveasfilename

For more information about "Visual Basic Equivalents for Macro Functions and Commands," choose the Search button in Help and type:

Visual Basic equivalents, macro functions

Additional query words: 5.00c 5.00a

Keywords : kbprg PgmOthr
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c; winnt:5.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbinfo


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