You receive a run-time error when you use msoFileDialogSaveAs constant with FileDialog in Access 2002 (282335)



The information in this article applies to:

  • Microsoft Access 2002

This article was previously published under Q282335
Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

If you use the msoFileDialogSaveAs constant with FileDialog in a Microsoft Visual Basic module, your code is compiled as expected. However, when you run the code, you receive the following error message:
Run-time error '445':

Object doesn't support this action

CAUSE

This behavior occurs because the msoFileDialogSaveAs constant was not designed to be used in Microsoft Access.

MORE INFORMATION

The msoFileDialogSaveAs constant is designed for other Microsoft Office programs such as Microsoft Excel or Microsoft Word. However, the constant appears in the Auto List Members list in the Visual Basic Editor for Access. The Help file does not warn you that you cannot use this constant in Access.

Steps To Reproduce the Problem

  1. Start Access and create a new database.
  2. On the Tools menu, point to Macro, and then click Visual Basic Editor.
  3. On the Tools menu, click References.
  4. In the References dialog box, under Available References, click to select the Microsoft Office 10.0 Object Library check box, and then click OK.

    The Microsoft Office 10.0 Object Library must be referenced to use FileDialog.
  5. In the Immediate window, type the following

    ?Application.FileDialog(msoFileDialogSaveAs)

    and then press ENTER.

    Note that you receive the error message described in the "Symptoms" section.
  6. Click OK in the error message dialog box, change msoFileDialogSaveAs to msoFileDialogOpen, and then run the code again. Note that the Open dialog appears and no error message is returned.

Modification Type:MinorLast Reviewed:8/11/2004
Keywords:kbtshoot kbProgramming kberrmsg kbnofix kbprb KB282335