B
BTU_needs_assistance_43
I'm still new to VB and Access but I'm trying to make a database that will
automatically update anytime a new Excel report is filed on the network. I
already have the program written to the point that it searches for and puts
into cells the full file name/locations of recently modified Excel files in
the specific folders I want. My Access database then imports those file names
into a table and displays those names in a list box on a form. What i need to
do now, is make Access take the file names its given and go into them and
extract certain cells from the Excel reports on the network and bring them
into another table in Access and store that information in the database.
That certainly is where I need help, but also if anyone could tell me how to
write code into my Excel VB program so that it will update its list of
recently added files automatically without me having to open it and refresh
it every day. This below is the code I have so far... Thanks for your help I
really need it!
Private Sub FileSearch_Click()
With Application.FileSearch
.NewSearch
.LookIn = "X:\File Folder\Sub Folder"
.SearchSubFolders = True
.LastModified = msoLastModifiedThisWeek
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
Worksheets("sheet1").Activate
Worksheets("sheet1").Range("A2").Select
For i = 1 To .FoundFiles.Count
ActiveCell.Value = .FoundFiles(i)
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Next i
Else
End If
End With
End Sub
automatically update anytime a new Excel report is filed on the network. I
already have the program written to the point that it searches for and puts
into cells the full file name/locations of recently modified Excel files in
the specific folders I want. My Access database then imports those file names
into a table and displays those names in a list box on a form. What i need to
do now, is make Access take the file names its given and go into them and
extract certain cells from the Excel reports on the network and bring them
into another table in Access and store that information in the database.
That certainly is where I need help, but also if anyone could tell me how to
write code into my Excel VB program so that it will update its list of
recently added files automatically without me having to open it and refresh
it every day. This below is the code I have so far... Thanks for your help I
really need it!
Private Sub FileSearch_Click()
With Application.FileSearch
.NewSearch
.LookIn = "X:\File Folder\Sub Folder"
.SearchSubFolders = True
.LastModified = msoLastModifiedThisWeek
.FileType = msoFileTypeExcelWorkbooks
If .Execute > 0 Then
Worksheets("sheet1").Activate
Worksheets("sheet1").Range("A2").Select
For i = 1 To .FoundFiles.Count
ActiveCell.Value = .FoundFiles(i)
ActiveCell.Offset(rowOffset:=1, columnOffset:=0).Activate
Next i
Else
End If
End With
End Sub