Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange problem with filesearch...help
Hi, I have found a very strange and dificullt problem to overcome in th filesearch. When a user tries to create a new workbook file in my program, it wil first check to see if the file already exists in the working folder for the application, and if it does, then it pops up a message sayin that it already exists so they cant create it. Ok, I thought it was perfect, until they discovered that if the have workbook named for example, week49-555EWO.xls, and they try to create file named week49-555.xls, the file search says that the file nam already exists!! So obviously Filesearch is using some sort of strin search that looks for any characters that exist within that fil name...for instance, if I try to create a new file calle week49-55.xls, it will also say it exists!! or any combination up t the last character of the name, week49-555EWO. It is ver frusterating, and I can't think of how to get around it . I have, o course, set the .MatchTextExactly to true, but that doesn't seem t make any difference. Here is my code Set objFileSearch = Application.FileSearch With objFileSearch .NewSearch .LookIn = startSearchDirectory .SearchSubFolders = True .filename = holdThisFileName .MatchTextExactly = True If .Execute 0 Then holdName = .filename MsgBox "There is already a file named " & holdThisFileName ", in the system. If you are unsure how to proceed then please spea to your supervisor.", vbOKOnly, "File Conflict..." Application.ScreenUpdating = True Application.DisplayAlerts = True Exit Sub End If End With Any ideas, anyone? Thanks, Ree ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange problem with filesearch...help
The line holdName = .filename is not supposed to be there...was some wrong code Thx ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange problem with filesearch...help
Set objFileSearch = Application.FileSearch
With objFileSearch .NewSearch .LookIn = startSearchDirectory .SearchSubFolders = True .filename = holdThisFileName 'MatchTextExactly = True If .Execute 0 Then for i = 1 to .foundfiles.count if Ucase(holdThisFileName) = Ucase(.filename(i)) then MsgBox "There is already a file named " & holdThisFileName & ", in the system. If you are unsure how to proceed then please speak to your supervisor.", vbOKOnly, "File Conflict..." Application.ScreenUpdating = True Application.DisplayAlerts = True Exit Sub end if Next End If End With -- Regards, Tom Ogilvy reesmacleod wrote in message ... The line holdName = .filename is not supposed to be there...was some wrong code Thx ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange problem with filesearch...help
Thanks again Tom. You are Invaluable. I came up with a similar solution not too long after, and as I think on it I am surprised about that behaviour. Is it a bug? Shouldn't ..MatchTextExactly only find entire string matches and not partial matches? Rees ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Strange problem with filesearch...help
MatchTextExactly refers to doing a search for text contained in a file, not
the name. -- Regards, Tom Ogilvy "reesmacleod" wrote in message ... Thanks again Tom. You are Invaluable. I came up with a similar solution not too long after, and as I think on it I am surprised about that behaviour. Is it a bug? Shouldn't MatchTextExactly only find entire string matches and not partial matches? Rees ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ ~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Strange Problem | Excel Discussion (Misc queries) | |||
Strange Problem... | Excel Discussion (Misc queries) | |||
FileSearch Problem | Excel Programming | |||
FileSearch Problem | Excel Programming | |||
FileSearch Problem | Excel Programming |