Check online help about find:
Function Find(Target As String, StartLine As Long, StartColumn As Long,
EndLine As Long, EndColumn As Long, [WholeWord As Boolean = Falso],
[MatchCase As Boolean = Falso], [PatternSearch As Boolean = Falso]) As Boolean
of VBIDE.CodeModule
try ....
Sub test()
Dim WB As Workbook
Set WB = Workbooks("cartel2") '<< change with your name workbook
ReplaceCodeInModule WB, "module1", "Long", "Double", True
End Sub
Sub ReplaceCodeInModule( _
WB As Excel.Workbook, _
sModuleNmae As String, _
sFind As String, _
sReplace As String, _
Optional bWholeWord = False, _
Optional dMatchCase = False, _
Optional bPatternSearch = False)
Dim i As Long
With WB.VBProject.VBComponents.Item(sModuleNmae).CodeModule
Do Until .Find(sFind, i, 1, -1, -1, bWholeWord, _
dMatchCase, bPatternSearch) = False
.ReplaceLine i, Replace(.Lines(i, 1), _
sFind, sReplace)
Loop
End With
End Sub
regards
r
Il mio ultimo lavoro ...
http://excelvba.altervista.org/blog/index.php/Excel-VBA/UsedRange-eccezioni-e-alternative.html
2003/ 2007
Is it possible, using VBA, to do a search/replace in another VBA module's IDE Code window with VBA?
If so, What objects are involved? Is there a link explaining the process?
TIA EagleOne