ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set fs = Application.FileSearch (https://www.excelbanter.com/excel-programming/409413-set-fs-%3D-application-filesearch.html)

[email protected]

Set fs = Application.FileSearch
 
Hello Group,

I am using

Set fs = Application.FileSearch

With fs
.......
.......
........
End With

I get "Object required" error. So, what should I dim "fs" as? Should I
need to do something like

Dim wb as workbook?
If so, then what would be
Dim fs as ?

Kevin

[email protected]

Set fs = Application.FileSearch
 
Got it.. The following does the trick.

With Application.FileSearch
.....
.......
........
End With

Kevin

On Apr 15, 9:32 am, wrote:
Hello Group,

I am using

Set fs = Application.FileSearch

With fs
......
......
.......
End With

I get "Object required" error. So, what should I dim "fs" as? Should I
need to do something like

Dim wb as workbook?
If so, then what would be
Dim fs as ?

Kevin



Office_Novice

Set fs = Application.FileSearch
 
Somthing like this maybe

Sub Find()
Dim fs As Object

Set fs = Application.FileSearch

With fs
.LookIn = "c:\my documents"
.FileType = msoFileTypeExcelWorkbooks
.Execute

End With
End Sub



" wrote:

Hello Group,

I am using

Set fs = Application.FileSearch

With fs
.......
.......
........
End With

I get "Object required" error. So, what should I dim "fs" as? Should I
need to do something like

Dim wb as workbook?
If so, then what would be
Dim fs as ?

Kevin


[email protected]

Set fs = Application.FileSearch
 
On Apr 15, 11:45*am, Office_Novice
wrote:
Somthing like this maybe

Sub Find()
* * Dim fs As Object

* * Set fs = Application.FileSearch

* * With fs
* * * * .LookIn = "c:\my documents"
* * * * .FileType = msoFileTypeExcelWorkbooks
* * * * .Execute

* * End With
End Sub



" wrote:
Hello Group,


I am using


Set fs = Application.FileSearch


With fs
.......
.......
........
End With


I get "Object required" error. So, what should I dim "fs" as? Should I
need to do something like


Dim wb as workbook?
If so, then what would be
Dim fs as ?


Kevin- Hide quoted text -


- Show quoted text -


It works if you just dim it and not set its type:

Dim fs
Set fs = Application.FileSearch


Cory

Dave Peterson

Set fs = Application.FileSearch
 
Or even:

dim FS as FileSearch



" wrote:

On Apr 15, 11:45 am, Office_Novice
wrote:
Somthing like this maybe

Sub Find()
Dim fs As Object

Set fs = Application.FileSearch

With fs
.LookIn = "c:\my documents"
.FileType = msoFileTypeExcelWorkbooks
.Execute

End With
End Sub



" wrote:
Hello Group,


I am using


Set fs = Application.FileSearch


With fs
.......
.......
........
End With


I get "Object required" error. So, what should I dim "fs" as? Should I
need to do something like


Dim wb as workbook?
If so, then what would be
Dim fs as ?


Kevin- Hide quoted text -


- Show quoted text -


It works if you just dim it and not set its type:

Dim fs
Set fs = Application.FileSearch

Cory


--

Dave Peterson


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com