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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Specify Excel File To Link To

Status
Not open for further replies.

hedidit

Technical User
Jul 21, 2005
142
GB
Hi haven't used MS access as a front end for several years... anyway when i was using it lots i wrote some code that prompted the user for the location of an excel file on their PC and then linked to each worksheet in the file. Unfortunately i no longer have the code and can't remember how to do it!

Can anyone give me any pointers?

Cheers
 
Thanks for the response mp9... in the end i've used:

Code:
Dim strfilelist As String
Dim i As Integer
Dim strLocation As String

strLocation = "C:\standalone\"
With Application.FileSearch
.lookin = strLocation
.Filename = "*.xls"
.SearchSubFolders = False
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
If Len(strfilelist) > 0 Then
strfilelist = strfilelist + ";"
End If
strfilelist = strfilelist + .FoundFiles(i)
Next i
Me.strfilelist.RowSource = strfilelist
Else
MsgBox "No files found" & vbLf & strLocation
Me.strfilelist.Visible = False
End If
End With

in the onload form event. I then have a select menu called strfilelist that displays all xls docs in the directory.

Cheers for the reference...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top