Filesearch Filename Wildcard Before Specified Keywords
Jan 17, 2007
I've gotten the Filesearch function to work in VBA when using a wildcard after the keywords like this: "SomeFile*.xls".
But I can't get it to work with keywords after the wildcard character like this: "*someFile.xls"
View 3 Replies
ADVERTISEMENT
Jun 22, 2006
I'm trying to close files which satisfy the criteria that the filename contains the word "monthlyreport". I tried the code below what it doesn't work at all. I'm also hoping in the future I can add on other criteria, e.g. contains the word 'monthly report' or starts with 's', maybe another If in the code? I'm really not sure..
Sub Close()
Dim wbMonth As Workbook
If wbMonth. Name Like "*monthlyreport*" Then
wbMonth.Close False
End If
End Sub
View 5 Replies
View Related
Nov 11, 2008
I am trying to use a sub to count files that some one has helpd me out with in the past. It was working but for some reason now it is not. I always have 0 returned as the number of files in the selected location (SourcePath), which is a filthy lie as there are files in there. The idea is that all .xls and all .xml files are deleted, and then if the folder is empty, that is also deleted, but as the Count_Files sub is always returning 0 the code is trying to delete the folder, which causes an error as it has files in it.
View 8 Replies
View Related
Dec 11, 2007
I can't seem to find Zip Files with FileSearch..I'm trying to search for and copy specific zip files from my temporary internet files folder to another folder. But it doesn't find them. It works with any other type of file. But it just won't find Zip files. And it's not because it's the temporary internet files folder, because it finds OTHER typs of files in the same folder, just not zip files.
I Have also tried using "*.zip" - Does not find any files, when I know they are there.
And Have tried "*.*" DOES find hundreds of files...
I have also tried serching in a Standard Non Sytem Non Hidden Type of folder. DOES NOT find zip files.
Even more maddening, It worked yesterday.....I already tried system restore.
Sub testing2()
Call GetFromTemp("Filename.zip")
End Sub
Public Function GetFromTemp(Fname As Variant)
Dim i
'Copies Downloaded Zip file from Temporary Internet Files to Downloaded Database FilesTemp
'Fname is Filename.zip you want to search for in Temporary Internet Files
View 9 Replies
View Related
Aug 19, 2008
I understand that Microsoft left Filesearch out of VBA for Office 2007 because it was buggy. Sadly, however, I still need it. It would help if they placed a comment in VBA help that stated that it was discontinued. As it is, they make it look as if Filesearch is still available for use. OK, I'll stop ranting now.
After reading several earlier posts, apparently I have to use the Dir function. I learn visually and cannot figure out how to use the function from the VBA help file since there are no examples. Does anyone have an example of code using the Dir function to insert filenames in an array? Once I see the code, I'm sure I can adapt it to suit my needs.
View 9 Replies
View Related
Feb 9, 2009
When I noticed that FileSearch was missing after I updated to Office 2007, I decided to recreate the class and save it as a file to import anytime I needed to use it. I tried to use as little code as possible, so if there is some property you would need to add then you may have to add it yourself, but this will at least give you most of the funcitonality of the original Class without having to update your existing code too much.
You have to just reference the class and then it can still be used in a with block or however you are accustomed. Here are the two class files that I have, the first I named FileSearch (go figure):
Dim pLookIn As String
Dim pSearchSubFolders As Boolean
Dim pFileName As String
Public FoundFiles As New Collection
Public Property Get LookIn() As String
LookIn = pLookIn
End Property
Public Property Let LookIn(value As String)
pLookIn = value
End Property
Public Property Get SearchSubFolders() As Boolean
LookIn = pSearchSubFolders...................................
View 9 Replies
View Related
Jun 27, 2007
I have created a macro that must extract data from other workbook. It opens the workbook, with an exist, and isopened control, and then open it. It´s running well, but i found while making another macro, that if the file direction is "http://www.xxx.com:8080/Challange%20Cost%20Proposal%20Sheet.xls", then i cant run the exist control. Next you have the code im using. In the first version, i had .LookIn = ThisWorkbook.Path. Now I´ve tried:
1. Dont put .LookIn, and fName is "http://www.xxx.com:8080/Challange%20Cost%20Proposal%20Sheet.xls"
2. .LookIn = "http://www.xxx.com:8080/"
.FileName = "Challange%20Cost%20Proposal%20Sheet.xls"
Both are failing, it says, the file doesnt exist. If i try directly WorkBooks.Open "http://www.xxx.com:8080/Challange%20Cost%20Proposal%20Sheet.xls", it opens correctly, but i would have a control, because the original file name could change, and the macro would crash if does.
Function OpenWorkBook(fName) As Integer
If Exists(fName) Then
If (IsOpen(fName) = False) Then
Workbooks.Open (fName)
OpenWorkBook = True
Else
MsgBox "The WorkBook " & originWorkBookName & " is already open."
OpenWorkBook = -1
End If
Else.........................
View 5 Replies
View Related
Jul 7, 2006
I am trying to display the Filename in a cell on my worksheet. However, when I enter the =Cell("filename"), it provides the full path (C:/Documents......Cost Summary.xls) How can I display only the filename without the path?
View 3 Replies
View Related
Feb 5, 2010
Filesearch......
Just been upgraded to 2007 and computer says no......
Iv only been VBA'ing for around 6 months and really am still very new to it.....
The bit that goes wrong is:
View 11 Replies
View Related
Mar 3, 2007
The following code works fine in Excel 2003 but returns the following error in Excel 2007:
Run time error '445'
Object does not support this action
Sub List_Files()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
.LookIn = "C:DepartmentsInventory"............
View 9 Replies
View Related
Apr 18, 2009
It seems to me that Application.FileSearch is not working with XP SP3.
I have a code that used Application.FileSearch and it works perfectly at home. But when I use in the office, it does not work. When I click on HELP menu, the one in the office has a Microsoft Excel 2003 SP3 whereas the one at my home does not have the SP3.
View 9 Replies
View Related
Aug 22, 2008
Before upgrade to Microsoft 2007 this code worked well (for 3 years). I marked it well with big space & comment where it gets hung up. The line says: With Application.Filesearch. All is well up to that point. I have another program that seems to have a problem when it comes to "With Application" as well. It must have to do with the upgrade, because my programs have been used daily, and it was right after the upgrade that it got buggy. All of the users were upgraded to Microsoft 2007 at the same time.
Sub Rpitracking()
'Collects data from records
Application.ScreenUpdating = False
Dim MyCandidate
Sheets("PI Tracking").Activate
Set Level = Range("I5:I100")
Sheets("PI Tracking").Range("J5:Z100").Select
Selection.ClearContents 'Clears info pulled from records
Sheets("PI Tracking").Range("5:100").Font.ColorIndex = 0 'Colors all rows black
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic
Range("ID").Offset(1, 0).Select
Selection.QueryTable.Refresh BackgroundQuery:=False
'Application.Calculation = xlAutomatic
For Each Cell In Level
Cell.Select
If Cell.Value <> "" Then 'Checks to see if Application date us there
If Cells(Cell.Row, 9).Formula <> "" Then 'Checks to see if app date is there
MyCandidate = Cells(Cell.Row, 2) & " " & Cells(Cell.Row, 1)
View 4 Replies
View Related
May 20, 2006
I'm trying to get a count of the number of workbooks in a directory and it keeps returning 0 when there are three WBs in the directory. What am I doing wrong?
Here is my code.
With Application.FileSearch
.LookIn = "C:Documents and Settingsdt64864DesktopTesting"
.Filename = "*.xls"
.FileType = msoFileTypeExcelWorkbooks
.Execute
MsgBox (.FoundFiles.Count)
End With
View 9 Replies
View Related
Nov 3, 2009
This relates to Excel for Mac 2004
I'm trying to use Application.FileSearch in a procedure to open files in a folder one by one and then do some stuff. It works fine when I developed it on my Windows machine but won't work on the Mac platform. The culprit instruction seems to be the
Application.FileSearch instruction, and I've also tried what I think may be a Mac equivalent Application.FileFind, but I get the 'Object doesn't support this action' error.
So I wrote a simple procedure below just to test the .FileSearch instruction but this fails in the same way.
Any ideas anyone? I've commented out lines which relate to Windows syntax.
View 12 Replies
View Related
Dec 1, 2006
I need to be able to open a filenamed in the following format.
c:/workbook20060112.txt.
However the lsat part of the string is dyanmic and works with one business days lag (hence format sheet (date, "yyyymmdd") ) is not approriate. i also have the problem that that MS Excel does not have a holiday calendar (so this would not work over bank holidays/easte/exmas ect). The folder also contains archived files as below.
c:/workbook20060112.txt
c:/workbook20061130.txt
c:/workbook20061129.txt
I have been told about a filesearch object as well as a filesystem object. What situations would you use one over the other?
What I want it the most upto data file to pick up, but I dont want to do a loop where it look through all the files or something that counts down from today until it 'hits' the correct file.
View 9 Replies
View Related
Jun 26, 2007
The Application.FileSearch method is not available in excel 2007, is there a similar functionality I can use?
View 9 Replies
View Related
Jun 26, 2008
I am trying to search a folder that is selected by the user for all .jpg files, and then place all those pictures onto a certain spreadsheet within the excel file. It also formats the pictures. Following is the
Private Sub BatchProcessThumb2x3()
Msg = "Select a file containing the photos you want to insert."
Directory = GetDirectory(Msg)
If Directory = "" Then Exit Sub
If Right(Directory, 1) "" Then Directory = Directory & ""
On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = Directory
.Filename = "*.jpg"
.SearchSubFolders = False
.Execute
' Select begining range
Worksheets("Thumbnail (2x3)").Select
Range("B4").Select
' Loop through all files and process them
For i = 1 To .FoundFiles.Count..............
View 9 Replies
View Related
Oct 11, 2006
I am using the following to compile data into a master workbook
With Application.FileSearch
.NewSearch
.LookIn = SrchDir
.SearchSubFolders = False
.FileType = msoFileTypeExcelWorkbooks
.LastModified = msoLastModifiedAnyTime
.Filename = "*.xls"
If .Execute > 0 Then
For Each vaFileName In .FoundFiles
' If vaFileName = Exclude Then GoTo n ' maybe something like this ?
ProcessData vaFileName
n: Next
and then processing each file, and adding it to the master. This is run every time a user opens the workbook. The number of workbooks in this folder is fairly large and more are added every day. What I would like to do is, compile a list of file names that have already been processed (I can handle that part) and then exclude them the next time the master book compiles from that folder. so if the master was run September 16th, all the data up to that point is already in the master and a list of those files is on a sheet in the book, now if the book is opened again on October 1st, it will look at the list first and only add the data from Sept. 17th through Oct 1st.
The file names I'm dealing with are named by date ie: 9-16-06.xls. The folder they're in is on a server so I can't just kill the directory after processing so that only new files are there, other people may need access to them. I think this may be handled at the "If Execute > 0" part of the code but am not adept enough to know how to do it. Possibly set "Execute" as a variant and have it cycle through the list
View 3 Replies
View Related
Sep 24, 2007
I have a macro running in Excel 2003 that uses application.filesearch. I discovered through another post that this is not included in Excel 2007. A replacement was suggested and I cannot get it to work. Can someone show me how to replace application.filesearch in my macro with the replacement code? I'm a real novice and can't figure out what I'm doing wrong. Or if you have a better solution I'm open for that as well.
Here's the original that works in 2003, the suggested replacement code will follow.
Sub GoGetData()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application. ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
Set wbCodeBook = ThisWorkbook
With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "C:Temp1"
View 3 Replies
View Related
Jan 26, 2008
Sub CombineWBs()
Dim wb As Workbook
Dim newWB As Workbook
Dim i As Long
On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = "C:Budget"
.Execute
Set wb = Workbooks.Open(.FoundFiles(1))
RenameWS wb
wb.Worksheets.Copy
Set newWB = ActiveWorkbook
wb.Close SaveChanges:=False
For i = 2 To .FoundFiles.Count
Set wb = Workbooks.Open(.FoundFiles(i))
RenameWS wb
wb.Worksheets.Copy After:=newWB.Worksheets(newWB.Worksheets.Count)
View 9 Replies
View Related
Jun 20, 2008
I have a macro that searches through a certain location for Excel files. The program and files were made in Office 2003. When another user runs the macro in Office 2007, the files are not recognized or the macro does not search, I'm not sure. Either way, the files are never located in their folder location. Any thoughts or ways around this?? The top part of the code is posted below,
Do
With Application.FileSearch
.NewSearch
'Change path to suit
.LookIn = "C:Documents"
.FileType = msoFileTypeExcelWorkbooks
'.Filename = " Book*.xls"
If .Execute > 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count ' Loop through all.
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
View 3 Replies
View Related
Jul 10, 2014
I am trying to NEXT my way through a column of comments and highlight the cells containing the key words. Below is what I have put together, but I know it is NOT working correctly....
[Code] .......
View 8 Replies
View Related
Nov 9, 2012
I have a column (Column B) that contains some free text and I have another column (column K, rows 3 to 12) that contains a series of keywords.
What I would like to be able to do is if column B contains one of the keywords in column K then that keyword is placed in column C.
There will only ever be one keyword per row.
View 2 Replies
View Related
Apr 23, 2009
I am calling a procedure from a commandbar button using on action.
With oButton
.Caption = "&Progress Report"
.OnAction = 'this bit please
.BeginGroup = True
.FaceId = 576
End With
Private Sub ProcessingRequest(ByVal shtRequest As String)
End Sub
View 9 Replies
View Related
Oct 25, 2006
I would like to develop a macro that can be run against an excel doc that will highlight keywords from a list I have established.
For example: If my excel doc contains the words, "sales, selling, sell, sale, school," make those words bold, red and 2 font sizes larger.
View 9 Replies
View Related
Mar 1, 2007
I'm working on an Excel spreadsheet and basicly i'm inserting manually data from a lot of paper forms.
It isn't a dificult thing, but is boring, because I have to do more than 2000 forms per week!
I want to accelerate, and how to do that
Problem: "Address"! The Excel page that i'm working has a column to feel with Addresses manually, but I have a table with all correct Address names from the city that I'm working about in other page.
What I would like is when start typing some keyword from the Address cell, it could show me all the choises of input (based on the correct Address Table)
Excel, by default, show, by exact order, all the choises, already typed on the same collumn.
I don't want that.
- imagine I have the Table 1 (representing the table with all city adresses) with a collumn called 'Address' with:
A1 - Street ZXY
A2 - Avenue QWE
A3 - Street QWE
A4 - Avenue ZXY
when typing on another Table, if I write something like “QWE” show me the A2 and A3 to choose wich I'm going to feel, and the same to “ZXY”, showing the A1 and A4. Other thing, if I write “QWE street” may show A3 also. Keyword is what i'm talking about
View 9 Replies
View Related
Jul 3, 2009
I have a piece of code that was written by someone else (namely Phil_V, from these very forums) that only works in versions of Excel before 2007. I was just hoping that someone could update the code for me?
I know it's a lot to ask, but I simply don't have the expertise to do it myself I really appreciate any help received.
The code that needs updating is as follows:
View 10 Replies
View Related
Jul 6, 2009
I am writing a class to be used in Excel 2007 that will mimic the action of the FileSearch in 2003, but I am stuck with the sort.
View 2 Replies
View Related
Dec 20, 2009
I wrote a macro to list all the excel files from a directory and its sub-directories to an excel sheet. It is working in excel 2003 but shows error (object does not support this action) in 2007. Actually I have copied almost this entire macro from excel 2007 help only. Can somebody modify this to use in both the versions of excel?
View 6 Replies
View Related
Jun 24, 2007
For those who use Application.FileSearch in Excel and Access, it's a huge pain that the object has been hidden in Office 2007.
I spent some time looking around for alternatives and have found two so far.
1. A FileSearch class that you can add to your project. Instead of using Application.FileSearch, you reference FileSearch instead
2. You can also use VBScript.
View 9 Replies
View Related