Application.FileSearch Not Working

rhjake23

New Member
Joined
Dec 20, 2017
Messages
35
Hello.
I have a vb script that works in Excel 2003 and now I need the script to work in Office 365.
I can paste the entire code if needed, but for starters, I am looking for the vb replacement for Application.FileSearch.
The code basically sets variables and searches the network drive for a particular folder (month) and then opens up a file and imports select columns back into a template.
I get an error: Object doesn't support this action: Run Time Error 445...... this happens on the following code line. Set fs = Application.FileSearch
Any ideas?
Thanks.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Unfortunately MS (in their wisdom) decided to remove that when they produced Xl 2007.
 
Upvote 0
There is & was going to point you to a site called XL-Central, but it doesn't seem to be available at the moment.
Will you just be searching one folder, or do you need to search subfolders as well?
 
Upvote 0
It would be searching a server path...then subfolders (which there would be 7 of them to be exact)
//server1/folder1
//server1/folder2
etc...
Thank you !!
 
Upvote 0
Do you know the folder name & full path, or do you need to search for the folder?
 
Upvote 0
I will know the folder name (depending on a variable) which is working... and I will know the 7 subfolders as those never change.
 
Upvote 0
In that case you could use something like
VBA Code:
Sub rhjake()
   Dim StartPth As String
   Dim aryFldr As Variant
   Dim i As Long
   Dim Wbk As Workbook
   
   StartPth = "C:\Mrexcel\"
   aryFldr = Array("Folder1\", "Folder2\", "Folder3\")
   For i = 0 To UBound(aryFldr)
      Set Wbk = Workbooks.Open(StartPth & aryFldr(i) & "Book1.xlsx")
      'do something
      Wbk.Close False
   Next i
End Sub
 
Upvote 0
ok thank you ! I will try and implement that....if I can't get it... do you mind if I paste the entire code in here?
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,585
Members
448,972
Latest member
Shantanu2024

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
Back
Top