+ Reply to Thread
Results 1 to 8 of 8

Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

  1. #1
    Registered User
    Join Date
    01-15-2011
    Location
    Clearfield, UT
    MS-Off Ver
    Excel 2016
    Posts
    58

    Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    Last year I was using Excel 2003, but this year my company switched to 2010 and the macro I was using no longer works...I get the Run-time Error 445 where file search is no longer supported. I'm still in the very early stages of learning VBA, so I'm wondering if there is a work-around to get the macro working again. (If this has already been addressed in the forum, I apologize; I couldn't find the thread. If that is the case, could you direct me to that thread so we don't rehash this?)

    I don't know if you need to see the whole code, but here's the first part of it ("Set fs = Application.FileSearch" is where it trips up):

    Please Login or Register  to view this content.
    Thanks in advance for advice & help!

    JPDutch
    Last edited by JPDutch; 01-03-2013 at 02:33 PM. Reason: Problem Solved

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    you can use Dir instead-see this post for example: http://www.ozgrid.com/VBA/2007-files...lternative.htm
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Registered User
    Join Date
    01-15-2011
    Location
    Clearfield, UT
    MS-Off Ver
    Excel 2016
    Posts
    58

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    Forgive my inexperience, but do I simply remove the "Set fs = Application.FileSearch" line and insert the "ChDir strPath" line in its place? Or do I need to re-write the first part of the macro? ...if so, I'm lost. What would that look like in my code??? I looked at the example you linked me to, but I don't know how to adapt that code to my macro. Would it be helpful if I sent you the entire macro code?)

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    no-it would be more like this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-15-2011
    Location
    Clearfield, UT
    MS-Off Ver
    Excel 2016
    Posts
    58

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    Thanks...I tried it, but now I'm getting a "Compile error: Invalid or unqualified reference" and refers me to the first line: Sub InserYearBranchNumberVLkup2(). If you have time, could you look at the whole code (it's long) and let me know where I went wrong???

    Thanks in advance!!!

    Please Login or Register  to view this content.

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    you haven't used the code I posted for the workbooks.open part

  7. #7
    Registered User
    Join Date
    01-15-2011
    Location
    Clearfield, UT
    MS-Off Ver
    Excel 2016
    Posts
    58

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    THANK YOU! That did it...I didn't look at the line close enough and thought it was the same as in the old code. Problem solved!!!

    Thanks Joseph

  8. #8
    Registered User
    Join Date
    09-05-2013
    Location
    Niksic, montenegro
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Work around for Run-time Error 445: Object Doesn't Support This Action (File Search)

    I have same problem... any help would be greatly appreciated


    Function FileList(folder As String, match As String, subfolders As Boolean)

    Dim list() As String, file As String
    Dim i As Integer
    i = 0
    Set Search = Application.FileSearch
    With Search
    .NewSearch
    .LookIn = folder
    .Filename = match
    .SearchSubFolders = subfolders
    total = .Execute()
    If total > 0 Then
    ReDim list(total - 1)
    For Each el In .FoundFiles
    file = CStr(el)
    list(i) = file
    i = i + 1
    Next
    Else
    ReDim list(0)
    list(0) = "()"
    End If
    End With
    FileList = list()
    Set Search = Nothing
    End Function

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1