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!

VBA Filesearch module Converted

Status
Not open for further replies.

Rzrbkpk

Technical User
Mar 24, 2004
84
US
I've used the module below in VBA for Access successfully. Now, I need to do something similar in VB. I'm using Visual Studio 8 and have very little experience with it. The problem I'm running into is that it does not like the syntax for my "Set" declaration. Any thoughts would be appreciated.

Private Sub Command0_Click
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Close Date Reporting\Reports"
.Filename = "Close Date Notification from*.xls"
If .Execute .execute
For I = 1 To .FoundFiles.Count
DoCmd.TransferSpreadsheet acImport, ,"Master Report Table", .foundfiles (I), True, "A18:G126"
Else
MsgBox "There were no files found."
End If
End With
End Sub
 
>I'm using Visual Studio 8

That is VB.NET and forum796 may be a better place for you.

Take care with use of FileSearch as I think it may have gone 'out of fashion' in Office 2007.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top