B
BTU_needs_assistance_43
I have an Excel program set up to search for recently added Excel documents
out of a certain folder and it works very well at doing that. Then I set up
an Access database to pull the names of those files out of Excel and put them
into a table which imports them into a list on a form. I've found plenty of
code on how to import whole Excel files and how to open Excel from within
Access. However thats not really what I want the program to do.
I want to be able to select the new file names from the list and click a
button and have my Access database import a constant set of cells (it will
always be the specific cells like C3, D3, F3, etc...) from any file I choose
off the list into a table.
That is my main concern but I would also appreciate help setting up my Excel
program to automatically run and update the list of recent files without me
having to open it and do it myself every day. Ill post the VB code from Excel
below, but I'm hitting a complete stone wall on the Access programming so
don't have anything solid. Thanks for any and all help!
Private Sub FileSearch_Click()
With Application.FileSearch
.NewSearch
.LookIn = "X:\File\Sub File\Report File"
.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
End If
End With
End Sub
out of a certain folder and it works very well at doing that. Then I set up
an Access database to pull the names of those files out of Excel and put them
into a table which imports them into a list on a form. I've found plenty of
code on how to import whole Excel files and how to open Excel from within
Access. However thats not really what I want the program to do.
I want to be able to select the new file names from the list and click a
button and have my Access database import a constant set of cells (it will
always be the specific cells like C3, D3, F3, etc...) from any file I choose
off the list into a table.
That is my main concern but I would also appreciate help setting up my Excel
program to automatically run and update the list of recent files without me
having to open it and do it myself every day. Ill post the VB code from Excel
below, but I'm hitting a complete stone wall on the Access programming so
don't have anything solid. Thanks for any and all help!
Private Sub FileSearch_Click()
With Application.FileSearch
.NewSearch
.LookIn = "X:\File\Sub File\Report File"
.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
End If
End With
End Sub