Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileDialog - Access XP - not working

Status
Not open for further replies.

Trevahaha

Programmer
Nov 21, 2002
129
US
I have the following code -- it gives an error and debugs on the "Set dlgSave = Applica..." with a runtime error of 445 "Object doesn't support this action"

Help says to set it like this:
Code:
Set dlgSaveAs = Application.FileDialog( _
    FileDialogType:=msoFileDialogSaveAs)

But this also gives an error: "Name argument not found"

Here's the code:

Code:
Public Function getNewFile() As String
Dim dlgSave As FileDialog
Set dlgSave = Application.FileDialog(msoFileDialogSaveAs)
With dlgSave
    With .Filters
        .Clear
        .Add "Text Files", "*.txt; *.txt", 1
        .Add "All files", "*.*", 2
    End With
    .FilterIndex = 1
    .AllowMultiSelect = False
    .Title = "Export File"
    .ButtonName = "Ok"
    .Show
    If .SelectedItems.count > 0 Then
        getNewFile = .SelectedItems(1)
    End If
End With
Set dlgSave = Nothing
End Function

Trevor
 
Yeah, I've seen that... but does anyone know how to get the built-in SaveAs function working?? It's kinda crazy, everything else works except the SaveAs.. and I can't find anywhere on the net a working example.

I had problems with the one you recommended... don't I just copy and paste it into a new Module? When i do this, it gives me all kinds of errors about comments.

Trevor
 
nevermind.. now the API way works. hehe

-trevor
 
Told you :)

works like a charm for me.
the other option was to use the msoFilePicker but it seems more tricky.

If it is there dont reinvent the wheel
 
But I'm still confused. Is there a bug in Access preventing the use of "msoFileDialogSaveAs" -- all the other options work (folder picker, file picker,etc.), just not the SaveAs dialog.

Trevor
 
Knowledge Base says the msoFileDialogSaveAs constant was not designed to work with Access (believe it or not) and no solution is given:

Microsoft Knowledge Base Article - 282335

ACC2002: Run-Time Error When You Use msoFileDialogSaveAs Constant with FileDialog

See the article here:


VBSlammer
redinvader3walking.gif

Unemployed in Houston, Texas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top