Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Open Searched File

Hi
What code shoul I write in order for it to search a pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the file.
Now, how do I open the searched file?

Regards
Pedro

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Open Searched File

In VBE help, see the Open method of the Workbook class.

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
On Fri, 11 Jul 2003 01:28:21 -0700, "Pedro" wrote:

Hi
What code shoul I write in order for it to search a pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the file.
Now, how do I open the searched file?

Regards
Pedro


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Open Searched File

Can you please be a little more specific
I am new on VBA
Thanks
Pedro

-----Original Message-----
In VBE help, see the Open method of the Workbook class.

HTH
Paul
---------------------------------------------------------

-----------------------------------------------------
Be advised to back up your WorkBook before attempting to

make changes.
---------------------------------------------------------

-----------------------------------------------------
On Fri, 11 Jul 2003 01:28:21 -0700, "Pedro"

wrote:

Hi
What code shoul I write in order for it to search a pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the

file.
Now, how do I open the searched file?

Regards
Pedro


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open Searched File

Sub GatherFiles()
Dim sName As String
Dim sPath As String
Dim sArr() As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.FileName = "MyExcelFile.xls"
'' .FileType = msoFileTypeAllFiles
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To 1 ' .FoundFiles.Count
set wkbk = Workbooks.Open(.Foundfiles(i))
' workbook is now open
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Can you please be a little more specific
I am new on VBA
Thanks
Pedro

-----Original Message-----
In VBE help, see the Open method of the Workbook class.

HTH
Paul
---------------------------------------------------------

-----------------------------------------------------
Be advised to back up your WorkBook before attempting to

make changes.
---------------------------------------------------------

-----------------------------------------------------
On Fri, 11 Jul 2003 01:28:21 -0700, "Pedro"

wrote:

Hi
What code shoul I write in order for it to search a pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the

file.
Now, how do I open the searched file?

Regards
Pedro


.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Open Searched File

Hi Tom

What should I add to that if the searched file as links
and I want to update them automatically whenever I open
the file.

Thanks
Pedro



-----Original Message-----
Sub GatherFiles()
Dim sName As String
Dim sPath As String
Dim sArr() As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.FileName = "MyExcelFile.xls"
'' .FileType = msoFileTypeAllFiles
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To 1 ' .FoundFiles.Count
set wkbk = Workbooks.Open(.Foundfiles(i))
' workbook is now open
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Can you please be a little more specific
I am new on VBA
Thanks
Pedro

-----Original Message-----
In VBE help, see the Open method of the Workbook class.

HTH
Paul
-------------------------------------------------------

--
-----------------------------------------------------
Be advised to back up your WorkBook before attempting

to
make changes.
-------------------------------------------------------

--
-----------------------------------------------------
On Fri, 11 Jul 2003 01:28:21 -0700, "Pedro"

wrote:

Hi
What code shoul I write in order for it to search a

pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the

file.
Now, how do I open the searched file?

Regards
Pedro

.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open Searched File

Sub GatherFiles()
Dim sName As String
Dim sPath As String
Dim sArr() As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.FileName = "MyExcelFile.xls"
'' .FileType = msoFileTypeAllFiles
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To 1 ' .FoundFiles.Count
set wkbk = Workbooks.Open(.Foundfiles(i), UpdateLinks:=3)
' workbook is now open
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Hi Tom

What should I add to that if the searched file as links
and I want to update them automatically whenever I open
the file.

Thanks
Pedro



-----Original Message-----
Sub GatherFiles()
Dim sName As String
Dim sPath As String
Dim sArr() As String
With Application.FileSearch
.NewSearch
.LookIn = "C:\"
.SearchSubFolders = False
.FileName = "MyExcelFile.xls"
'' .FileType = msoFileTypeAllFiles
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To 1 ' .FoundFiles.Count
set wkbk = Workbooks.Open(.Foundfiles(i))
' workbook is now open
Next i
Else
MsgBox "There were no files found."
End If
End With
End Sub

--
Regards,
Tom Ogilvy


"Pedro" wrote in message
...
Can you please be a little more specific
I am new on VBA
Thanks
Pedro

-----Original Message-----
In VBE help, see the Open method of the Workbook class.

HTH
Paul
-------------------------------------------------------

--
-----------------------------------------------------
Be advised to back up your WorkBook before attempting

to
make changes.
-------------------------------------------------------

--
-----------------------------------------------------
On Fri, 11 Jul 2003 01:28:21 -0700, "Pedro"
wrote:

Hi
What code shoul I write in order for it to search a

pre-
defined filename and open that searched file?
Someone already gave a tip to go to vba help. The vba
help for filesearch only explains how to search the
file.
Now, how do I open the searched file?

Regards
Pedro

.



.



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
Singling out searched cells Lycean Excel Discussion (Misc queries) 1 October 26th 09 07:33 PM
combination searched Mark Excel Worksheet Functions 1 December 6th 08 08:08 AM
In Excel - Use Windows Explorer instead of File Open to open file KymY Excel Discussion (Misc queries) 1 August 5th 06 09:59 PM
Additional Columns to be Searched Aviator Excel Discussion (Misc queries) 3 January 28th 05 11:27 PM
VBA: Return Searched Value Inputed by End-User Mcasteel Excel Worksheet Functions 1 October 28th 04 03:09 PM


All times are GMT +1. The time now is 04:44 AM.

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

About Us

"It's about Microsoft Excel"