TheWennerWoman
Active Member
- Joined
- Aug 1, 2019
- Messages
- 303
- Office Version
- 365
- Platform
- Windows
Hello,
I have the following code courtesy of @JEC (many thanks)
Which works perfectly and does a simple find/replace.
Can this be enhanced so that if these strings (not necessarily adjacent in the file)
are found then the second string needs to say
Thanks in advance as always.
I have the following code courtesy of @JEC (many thanks)
VBA Code:
Sub jec()
Dim it
With CreateObject("scripting.filesystemobject")
' specify source folder, file extension and what text needs to be replaced
For Each it In .GetFolder("W:\COYA\interfaces\MIPLoader\failed\").Files
If .GetExtensionName(it) = "XML" Then .CreateTextFile(it).Write Replace(.OpenTextFile(it).ReadAll, "<TaxCode>VIZERO</TaxCode>", "<TaxCode>VISTD</TaxCode>")
Next
End With
End Sub
Which works perfectly and does a simple find/replace.
Can this be enhanced so that if these strings (not necessarily adjacent in the file)
Code:
<DocumentMasterCode>PINVCAPX</DocumentMasterCode>
<InputTemplateMasterCode>PINVMAT</InputTemplateMasterCode>
are found then the second string needs to say
Code:
<InputTemplateMasterCode>PINVCAPX</InputTemplateMasterCode>
Thanks in advance as always.