Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am looking to do a search and replace for some code in all the codeModules
in my VBA Macro program. I am trying to do an automated program that searches for and finds the Excel Workbooks, finds what modules are each Workbook, and then replaces code. So it would replace XLFit3_ with XLFit4, but I am not exactly sure how to modify code in modules using the search and replace function. Anybody's help is more than welcome and thankfully appreciated. Here is what I have so far. What it does so far is open up the files that are already there, and loops until there are no more files, but I don't know how to change the code on the back end of these files. See below for code. Please don't point me to http://www.cpearson.com's website, I've been there already and is very informative, but I couldn't find anything exactly like this. Thanks for your help ahead of time. Sub FileSearchforMacros() Dim wkbkOne As Workbook With Application.FileSearch .LookIn = "\\RTTMSGFP141\smithb25$\Desktop\testvba" .SearchSubFolders = True .FileType = msoFileTypeExcelWorkbooks If .Execute() 0 Then MsgBox "There were " & .FoundFiles.Count & _ " file(s) found." For i = 1 To .FoundFiles.Count MsgBox .FoundFiles(i) Set wkbOne = Application.Workbooks.Open(.FoundFiles(i), , , , Password:=("INGRAM")) wkbOne.Save wkbOne.Close Next i Else MsgBox "There were no files found." End If End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Need Code To Print From Code Modules | Excel Programming | |||
Need Code To Print From Code Modules | Excel Programming | |||
VBA Code to Import VBA Modules | Excel Programming | |||
When to code in sheet or userform modules and when to use modules | Excel Programming | |||
editing code in modules through VB | Excel Programming |