Save As FileDialog (1 Viewer)

mbentley

Registered User.
Local time
Today, 05:45
Joined
Feb 1, 2002
Messages
138
I'm having trouble with the Save As FileDialog type.

My code:

Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogSaveAs)

Returns an <Object does not support this action> error.

Funny thing is that this works fine:

Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)

Unfortunately, I need to use the former (I think).

What I ultimately need to do is to use the FileDialog to return a string variable that I can use later. I don't actually need it to save a file, I just need the path and file name in a string.

Thanks!
 

mbentley

Registered User.
Local time
Today, 05:45
Joined
Feb 1, 2002
Messages
138
I found the answer to why the SaveAs doesn't work. For those interested, see this article .

So can anyone suggest how to do what I'm trying?
 

Drevlin

Data Demon
Local time
Today, 12:45
Joined
Jul 16, 2002
Messages
135
Any of the file pickers will do what you want. All they do is pass you the file's location string anyway. The following code will give you an array of file names (Access 2002 ):


With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = True
.InitialFileName = "C:\My Documents\*.*"
.Title = "Which File(s)"
.ButtonName = "My Choice"

If .Show = -1 Then
numOfFiles = .SelectedItems.Count
' Display paths of each file selected
For lngCount = 1 To numOfFiles
textArray(lngCount) = .SelectedItems(lngCount)
Next lngCount
Else
End
End If
End With

For x = 1 to numOfFiles
Debug.Print textArray(x)
Next x
 

mbentley

Registered User.
Local time
Today, 05:45
Joined
Feb 1, 2002
Messages
138
Drevlin...thanks for you input. Unfortunately the File Open dialog doesn't let the user create a new file name. It will only let them select and already existing file name. I need to allow them to do the former.

ghudson...thanks, I'll try that suggestion.
 

smed

Registered User.
Local time
Today, 12:45
Joined
Apr 18, 2002
Messages
50
Mike,

Have you tried using the ActiveX : Common Dialogs Control ?

I use it to obtaining a file name selected/specified in both a open & save file requester.

I have attached a simple db for you to have a look at.

Hope it's helps

Smed
 

Attachments

  • filerequester.zip
    24.5 KB · Views: 217

mbentley

Registered User.
Local time
Today, 05:45
Joined
Feb 1, 2002
Messages
138
Thanks Smed. I'll give that a try too.
 

Users who are viewing this thread

Top Bottom