'MacroName:505noR 'MacroDescription: removes $r from 505, useful for removing composers from non-classical records 'rewritten by John Lavalie, Dec. 11, 2008 option explicit '-------------------- function replace(strString as string, strOld as string, strNew as string) as string dim pos as integer pos = instr(strString, strOld) do while pos > 0 strString = left(strString, pos - 1) & strNew & mid(strString, pos + len(strOld)) pos = instr(strString, strOld) loop replace = strString end function '------------------- Sub Main Dim CS As Object Set CS = CreateObject("Connex.Client") dim tag505$ dim pos%, endPos%, nr505s%, cr% CS.GetField "505", 1, tag505$ tag505$ = replace(tag505$, " /", "") endpos% = -1 do pos% = instr(tag505$, chr(223) & "r") endPos% = instr(pos% + 1, tag505$, chr(223)) if endPos% > 0 and pos% > 0 then tag505$ = left(tag505$, pos% - 1) & mid(tag505$, endPos%) end if loop until endPos% = 0 or pos% = 0 pos% = instr(tag505$, chr(223) & "r") if pos% > 0 then tag505$ = left(tag505$, pos% - 2) & "." CS.DeleteField "505", 1 CS.AddFieldLine CS.CursorRow, "" CS.SetFieldLine CS.CursorRow, tag505$ End Sub