application filesearch XL2000 strange behaviour

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,824
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
this is a strange one, I am using XL2000 to search a series of folders containing WD2000 files for text within a document

On one folder only the macro will abort and shut down Excel when the search term is a single word, when it is a single letter, it will perform the search.

All other folders are fine, I have checked folder attributes and permissions, all seem to be similar across folders

The code is standard as found all over the net
With Application.FileSearch
.NewSearch
.LookIn = FolderToSearch
.SearchSubFolders = True
.FileName = "*.doc"
.MatchTextExactly = False
.TextOrProperty = TextToFind
.FileType = msoFileTypeWordDocuments
' .FileTypes.Add msoFileTypeExcelWorkbooks ' so we can AND in other file types

.Execute

It dies on the .execute when the TextToFind is a string of characters, all other variables are correctly loaded

The error is not trappable, and does not appear in system logs or Dr Watson

Anyone else seen this
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,824
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
UPDATE in case anyone gets this problem

Turned out to be a corrupt MSWORD file in the folder, found by removing all files from folder and adding in one by one.

opened the bogey MSWORD file selected and copied all contents, closed MSWORD, opened up MSWORD and pasted contents back into fresh document and saved, all working fine

Closing call
 
Upvote 0

Forum statistics

Threads
1,196,019
Messages
6,012,898
Members
441,738
Latest member
dataexcel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top