Importing Excel data from anywhere

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using Access 2000. I have a file to import in Excel. The file works great on the import no problem. My question is I have a button the user presses to import the file. The TransferSpreadsheet command forces me to point to a specific place the spreadsheet must be in order to import it. Is there a way to allow the user to choose the file path to import the file rather than a set place?
 
The ACCESS Web has some sample code for doing this with the API :

http://www.mvps.org/access/api/api0001.htm

--
Ken Snell
<MS ACCESS MVP>

RL said:
I'm using Access 2000. I have a file to import in Excel. The file works
great on the import no problem. My question is I have a button the user
presses to import the file. The TransferSpreadsheet command forces me to
point to a specific place the spreadsheet must be in order to import it. Is
there a way to allow the user to choose the file path to import the file
rather than a set place?
 
For older versions of Access try this:
http://www.mvps.org/access/api/api0001.htm

This code is a new feature in Access 2002.
It allows you to browse for a file and then store the selected file in 2
text boxes:
Me![txtLocalDir] , Me![txtLocalFileName]

'1 = DialogOpen, 2= SaveAs, 3=FilePicker, 4 = FolderPicker
'Cannot be used in Access 2000!
With Application.FileDialog(3)
.AllowMultiSelect = False
If .Show = True Then
Me![lblEdit].Visible = True
Me![txtLocalDir] = Left$(.SelectedItems(1),
InStrRev(.SelectedItems(1), "\"))
Me![txtLocalFileName] = Right$(.SelectedItems(1),
Len(.SelectedItems(1)) - InStrRev(.SelectedItems(1), "\"))
Me![txtLocalFileName].SetFocus
End If
End With

--
Joe Fallon
Access MVP



RL said:
I'm using Access 2000. I have a file to import in Excel. The file works
great on the import no problem. My question is I have a button the user
presses to import the file. The TransferSpreadsheet command forces me to
point to a specific place the spreadsheet must be in order to import it. Is
there a way to allow the user to choose the file path to import the file
rather than a set place?
 
Back
Top