Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
Office GroupsView
Excel
Excel Charting
Excel Crashesgpfs
Excel Misc
Excel Newusers
Excel Programming
Excel Setup
Excel Worksheet Functions
Word Application Errors
Word Conversions
Word Customization Menustoolbars
Word Docmanagement
Word Drawing Graphics
Word International Features
Word Mail
Word Mailmerge Fields
Word Newusers
Word Numbering
Word Oleinterop
Word Pagelayout
Word Printingfonts
Word Setup Networking
Word Spelling Grammar
Word Tables
Word Visual Basica Addins
Word Visual Basica Customization
Word Visual Basica General
Word Visual Basica Userforms
Works Win
Office Developer Automation
Office Developer Com Add_Ins
Office Developer Officedev Other
Office Developer Outlook Forms
Office Developer Outlook Visual Basica
Office Developer Visual Basica
Office Misc
Office Setup
Officeupdate
Onenote
Outlook
Outlook Bcm
Outlook Calendaring
Outlook Contacts
Outlook Fax
Outlook General
Outlook Installation
Outlook Interop
Outlook Mac
Outlook Printing
Outlook Program_Addins
Outlook Program_Forms
Outlook Program_Visual Basica
Outlook Teamfolders
Outlook Thirdpartyutil
Project
Project Developer
Project Server
Visio
Visio Developer
Visio General
Word Visual Basica Beginners
Outlookexpress General
Office Communicator
Word Programming
Office Templates Misc

Group SummariesView
.NET Framework
Access
BizTalk
Certifications
CRM
DDK
Exchange Server
FoxPro
French
French .NET
Games
German
German .NET
Graphic Design
IIS
Internet
ISA Server
Italian
Italian .NET
Maps
MCIS
Miscellaneous
Mobile Apps
Money
MSN
Networking
Office
Ops Mgr
Publisher
Security
SharePoint
Small Business
Spanish
Spanish .NET
SQL Server
Systems Management Server
Transaction Server
Virtual PC / Virtual Server
Visual Studio
Win32
Windows 2000
Windows 2003 Server
Windows 7
Windows Live
Windows Media
Windows Update
Windows Vista
Windows XP
 

View All Microsoft Word Visual Basica General Posts  Ask A New Question 

Application.FileSearch.Filename anomaly setting beginning of filename substring

FUBARinSFO posted on Thursday, December 06, 2007 8:45 PM

Hi:

The problem is that I want to find files like "'INV*.DOC", but I'm
also picking up "xxINV*.DOC" files as well.

DOS doesn't have this problem, but Application.FileSearch.Filename
seems to have it.

If I specifiy a wildcard for the file extension, it works OK, but not
if I specify the extension.  e.g. "INV*.*" doesn't pick up the

Indexing is turned off.  Using Word 2003. I have seen that there are
problems with this function, but I can't believe at Office11 this
problem hasn't been sorted out.

Code example below

Thanks in advance for your help.

-- Roy Zider


Public Sub TestFileSearch()
' 12/3/2007 lsz
' Testing application.filesearch for start of filename problem with
xxinv*.doc
' Test with three files: t1.txt, t2.txt and xxt3.txt

Dim oFS As Object
Dim i As Integer
Set oFS = Application.FileSearch
With oFS
.LookIn = "C:\temp test\filesearch"
.FileName = "t*.*"  ' OK - xxt3.txt not found
' .FileName = "t*.txt"  ' not OK -- finds xxt3.txt as well
' .FileName = "inv*.doc" ' not OK -- finds xxinv.doc
If .Execute > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

End Sub
reply

 

Well, that's not very logical, is it?

zki posted on Thursday, December 06, 2007 9:37 PM

Well, that's not very logical, is it?!  Anyway, here are a couple of fixes:

First, instead of Dim oFS As Object, dimension it as Dim oFS As FileSearch.
It won't change how the code works, but it will provide you pop-up content
help.

Second, change the document extension as follows:  "Inv*.doc" becomes

It works - can't explain why....
reply

Application.FileSearch.Filename anomaly setting

jeff denner posted on Thursday, July 09, 2009 11:14 AM

Hi

This post looks exactly what I want but the end part of the following sentence is missing

Second, change the document extension as follows:  "Inv*.doc" becomes

can anbody help

Thanks
reply

 
 

Previous Microsoft Word Visual Basica General conversation.