LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Serach and Replace across multiple files

You need to make use of the Microsoft Scripting runtime.

First create a reference to it in the Excel vbs ide (Tools references
and select Microsoft scripting runtime).

Then create a procedure such as:

Sub GetFileNames(strFolder)

Dim fso As New FileSystemObject
Dim dir As Folder
Dim fil As File
Dim wb As Workbook

Set dir = fso.GetFolder(strFolder)
For Each fil In dir.Files
Set wb = Workbooks.Open(fil.Path)
With wb
.Sheets(1).Range("D2").Value = "Goodbye"
.Close (True)
End With

Next fil
Set fso = Nothing
Set dir = Nothing
Set fil = Nothing

End Sub



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
Serach for multiple words in one cell Robert L. Excel Discussion (Misc queries) 3 September 15th 09 12:26 PM
serach of dat M.K[_2_] Excel Discussion (Misc queries) 1 March 17th 09 01:31 PM
Macro Involving Find & Replace In Two Different Files K8_Dog[_2_] Excel Discussion (Misc queries) 4 May 2nd 08 07:44 PM
How to find/replace all of the names of files in EXCEL workbook. Peter Multach Excel Discussion (Misc queries) 2 March 5th 07 02:52 PM
Copy over files/replace (complete question) G3£Wh\)zZ@ New Users to Excel 1 October 10th 05 10:38 AM


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

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"