At my work we changed out network mapping, and therefore there is a lot of chaos regarding directory links. I'm looking for an easy way to programmatically replace string in ALL modules within a database.
I've found how to do it in regular modules, however I do not know how to do the same for Form Modules, or Report Modules, etc.
Code:
Function modulechanges(Optional oldstring As String = "", Optional newstring As String = "")
For Each mdl In CurrentProject.AllModules
With mdl
If mdl.Name <> "Directory Change" Then
DoCmd.OpenModule mdl.Name
With Application.Modules(mdl.Name)
For i = 1 To .CountOfLines
If InStr(1, .Lines(i, 1), oldstring) <> 0 Then
.ReplaceLine i, Replace(.Lines(i, 1), oldstring, newstring)
End If
Next i
End With
DoCmd.Save acModule, mdl.Name
End If
End With
Next mdl
End Function
Is it possible to do the same for Form/report modules?