Hi all!
How Can I replace the 4th letter, the last letter of a word composed of 4 letters?
This word always will change, Ex. PATO, COME, VENA, BADA, MENU, OLED, SANI
I need to replace this 4th letter with an “X”, like this:
Ex. PATX, COMX, VENX, BADX, MENX, OLEX, SANX.
I think in Replace, but It finds an specific word to replace.
This is the routine that I’m using:
'This routine deletes any prohibited vulgarity words on spanish,
'changing the last character of that word to X.
Dim RFC As String
Dim DeleteProhibited As String
Dim strPalabras As String
'Define all prohibited words.
strPalabras = “BUEIBUEYCACACACOCAGACAGOCAKACAKOCOGECOJA”
strPalabras = strPalabras + “KOGEKOJOKAKAKULOMAMEMAMOMEAR*”
strPalabras = strPalabras + “MEASMEONMIONCOJECOJICOJOCULO*”
strPalabras = strPalabras + “FETOGUEYJOTOKACAKACOKAGAKAGO*”
strPalabras = strPalabras + “MOCOMULAPEDAPEDOPENEPUTAPUTO*”
strPalabras = strPalabras + “QULORATARUIN*”
'If anyone is found, change it.
If InStr(strPalabras, Left(strRFC, 4) + “*”) > 0 Then
'replace 4th letter of RFC to delete
'the prohibited word.
'Mid(strRFC, 4, 1) = “X”
End If
DeleteProhibited = strRFC
Return DeleteProhibited.
Any Ideas?