File Dialog Picker

D

Diane

I am attempting to use the dialog picker to select a file from a dialog box
and then use that same file in the DoCmd.transferspreadsheet method. It
allows me to select the file, but then it gives me an error message stating
can not find the file ...mso/FileDialogFilePicker.

My code is:

Private Sub Command1_Click()
On Error GoTo test_import_Err

Dim fd As FileDialog

Set fd = Application.FileDialog(msoFileDialogFilePicker)

Dim vrtSelectedItem As Variant

With fd

If .Show = True Then

For Each vrtSelectedItem In .SelectedItems

Next vrtSelectedItem

Else

End If

End With

DoCmd.TransferSpreadsheet acImport, 8, "H_and_W Temp", fd, True

test_import_Exit:
Exit Sub

test_import_Err:
MsgBox Error$
Resume test_import_Exit

End Sub
 
D

Douglas J. Steele

Sounds as though you're missing a reference to the appropriate Office object
for your version of Access.

However, my advice would be to scrap the use of the FileDialog object and
replace it with the API code illustrated in
http://www.mvps.org/access/api/api0001.htm at "The Access Web"
 
D

Diane

Thank you so very much. I referenced the object and it worked like a charm
and your site is a great help to me.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top