Ben_Entrew
Registered User.
- Local time
- Today, 06:26
- Joined
- Dec 3, 2013
- Messages
- 177
Hi all,
I got following issue: Want to replace a string in my VBA code.
Tried this one, however it doesn't replace the string:
Public Sub ttt()
Dim vbComp As VBComponent
Dim mdl As CodeModule
Dim i As Integer
Dim lin As Variant
For Each vbComp In Application.VBE.ActiveVBProject.VBComponents
Set mdl = vbComp.CodeModule
For i = 1 To mdl.CountOfLines
lin = mdl.Lines(i, 1)
If InStr(1, lin, "X:") Then
lin = Replace(lin, "X:", "\\abcs\de")
End If
Next i
Next vbComp
End Sub
Many things in advance.
Regards,
Ben
I got following issue: Want to replace a string in my VBA code.
Tried this one, however it doesn't replace the string:
Public Sub ttt()
Dim vbComp As VBComponent
Dim mdl As CodeModule
Dim i As Integer
Dim lin As Variant
For Each vbComp In Application.VBE.ActiveVBProject.VBComponents
Set mdl = vbComp.CodeModule
For i = 1 To mdl.CountOfLines
lin = mdl.Lines(i, 1)
If InStr(1, lin, "X:") Then
lin = Replace(lin, "X:", "\\abcs\de")
End If
Next i
Next vbComp
End Sub
Many things in advance.
Regards,
Ben
Last edited: