Sub replaceConstant()Dim project As VBIDE.VBProject
Dim codeMod As VBIDE.CodeModule
Dim component As VBIDE.VBComponent
Dim n As Long, s As String
For Each project In Application.VBE.VBProjects
For Each component In project.VBComponents
If component.Name <> "replaceConstant" Then
Set codeMod = component.CodeModule
With codeMod
For n = 1 To .CountOfLines
s = .Lines(n, 1)
If Len(Trim$(s)) Then
If s Like "*" & Old_Text & "*" Then
s = Replace$(s, Old_Text, New_Text)
.DeleteLines n, 1
.InsertLines n, s
End If
End If
Next
End With
'Dim startline As Long
'startline = 1
'codeMod.Find Target:="Old_Text", _
'startline:=startline, startcolumn:=1, endline:=codeMod.CountOfLines, endcolumn:=1
'codeMod.ReplaceLine startline, "New_text"
End If
Next component
Next project
End Sub