Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default .LookIn problem 2007

This is code from excel help, Office 2007 excel running windows 7 64 bit.

Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents"
.FileName = "cmd*.*"
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With


The code produces the error "object doesn't support this action" at "Set
fs = Application.FileSearch." I tried "Dim fs as Application" but got
same error.

My first venture into this so I don't know what is going on.

I want to open every excel program in a particular folder, get stuff
from it etc. and close it.

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 298
Default .LookIn problem 2007

FileSearch is no longer part of Excel 2007.
Plenty of alternative approaches to be found via google. Eg:
http://www.ozgrid.com/forum/showpost...73&postcount=4

Tim

"John" wrote in message
...
This is code from excel help, Office 2007 excel running windows 7 64 bit.

Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents"
.FileName = "cmd*.*"
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With


The code produces the error "object doesn't support this action" at "Set
fs = Application.FileSearch." I tried "Dim fs as Application" but got same
error.

My first venture into this so I don't know what is going on.

I want to open every excel program in a particular folder, get stuff from
it etc. and close it.

John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default .LookIn problem 2007

Application.FileSearch Property is not available in 2007 version. Instead try
using Dir ..or check out help on FileSystemObject...

If you want to filter by xl files then try cmd*.xl*

Sub Macro()
Dim strFile As String, strFolder As String
strFolder = "C:\"
strFile = Dir(strFolder & "\cmd*.*", vbNormal)
Do While strFile < ""
MsgBox strFile
strFile = Dir
Loop
End Sub

--
Jacob


"John" wrote:

This is code from excel help, Office 2007 excel running windows 7 64 bit.

Set fs = Application.FileSearch
With fs
.LookIn = "C:\My Documents"
.FileName = "cmd*.*"
If .Execute 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With


The code produces the error "object doesn't support this action" at "Set
fs = Application.FileSearch." I tried "Dim fs as Application" but got
same error.

My first venture into this so I don't know what is going on.

I want to open every excel program in a particular folder, get stuff
from it etc. and close it.

John
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default .LookIn problem 2007

Ok, thanks... I got all that. Now another problem.

Dim FileName as string
Dim Wb as Workbook
I get the name of the workbook file in the string then open it with
Set Wb = Applicatin.Workbooks.Open(Filename, , , , "password")

How do I get the workbook to say hidden? I want to get info out of it
but I don't want it to be flashing all over the screen when I open and
access it.

I tried Wb.hide but it said isn't appropriate.

Thanks
JOhn




Jacob Skaria wrote:
Application.FileSearch Property is not available in 2007 version. Instead try
using Dir ..or check out help on FileSystemObject...

If you want to filter by xl files then try cmd*.xl*

Sub Macro()
Dim strFile As String, strFolder As String
strFolder = "C:\"
strFile = Dir(strFolder & "\cmd*.*", vbNormal)
Do While strFile < ""
MsgBox strFile
strFile = Dir
Loop
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default .LookIn problem 2007

If you're just opening it briefly to extract information:

Application.Screenupdating=false
'open, extract, close
Application.Screenupdating=true

Tim

On Dec 2, 6:42*am, John wrote:
Ok, thanks... I got all that. Now another problem.

Dim FileName as string
Dim Wb as Workbook
I get the name of the workbook file in the string then open it with
Set Wb = Applicatin.Workbooks.Open(Filename, , , , "password")

How do I get the workbook to say hidden? I want to get info out of it
but I don't want it to be flashing all over the screen when I open and
access it.

I tried Wb.hide but it said isn't appropriate.

Thanks
JOhn




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default .LookIn problem 2007

Thanks
John
Tim Williams wrote:
If you're just opening it briefly to extract information:

Application.Screenupdating=false
'open, extract, close
Application.Screenupdating=true

Tim

On Dec 2, 6:42 am, John wrote:
Ok, thanks... I got all that. Now another problem.

Dim FileName as string
Dim Wb as Workbook
I get the name of the workbook file in the string then open it with
Set Wb = Applicatin.Workbooks.Open(Filename, , , , "password")

How do I get the workbook to say hidden? I want to get info out of it
but I don't want it to be flashing all over the screen when I open and
access it.

I tried Wb.hide but it said isn't appropriate.

Thanks
JOhn


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with setting a R / W property, FileSearch, LookIn chuckd Excel Programming 2 November 9th 06 03:31 PM
Cannot assign value to Filesearch.Lookin QQExcel Excel Programming 3 August 5th 04 04:20 PM
can not assign value to LookIn QQExcel Excel Programming 1 July 30th 04 07:44 PM
Lookin Property. Simon[_14_] Excel Programming 3 April 20th 04 02:17 PM
Using a variable with .LookIn Mike Berry Excel Programming 0 July 14th 03 12:29 PM


All times are GMT +1. The time now is 07:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"