Function Replace(ByVal BeforeString, ByVal BeforeWord, ByVal AfterWord)
'文字列の置換。Replace(対象文字列,変換する語,変換後の語)
Dim AfterString,Pos
Do While BeforeString<>""
If Instr(BeforeString, BeforeWord) Then
AfterString=AfterString+Left(BeforeString,Instr(BeforeString,BeforeWord)-1)+AfterWord
BeforeString=Mid(BeforeString,Instr(BeforeString, BeforeWord)+Len(BeforeWord))
Else
AfterString=AfterString+BeforeString
BeforeString=""
End If
Loop
Replace =AfterString
End Function