View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default FileSearch error 1004

Hi,

I suggest that you insert some MsgBox's immediately prior to
'With Application.FileSearch' line and check what values you have in the
variable parts of your code. Without actually testing, my first thoughts are
that since you have installed a new operating system, the path may no longer
be correct.

Example:-
MsgBox "LookIn variable is: " & myCell.Offset(1, 0).Value
MsgBox "CSubFolders is: " & CSubFolders
MsgBox "myCell.Offset(1, 1).Value is: " & myCell.Offset(1, 1).Value

Regards,

OssieMac


"Daher Abdeen" wrote:

i have a macro using Application.FileSearch in excell and was working
perfectly. only when we installed windows XP the file search is generating
run time error 1004 as "can't move focus to the control as it is invisible,
not enabled, or of a type that does not accept focus"

can someone help ?


This is my code

With Application.FileSearch
.NewSearch
.LookIn = myCell.Offset(1, 0).Value
.SearchSubFolders = CSubFolders
.Filename = myCell.Offset(1, 1).Value
.MatchTextExactly = CmatchExactTxt
.FileType = msoFileTypeAllFiles

End With


Reg. Daher