Attribute VB_Name = "modMisc" Option Explicit Public Function getFileText(ByVal strFile As String, Optional ByRef success As Boolean) As Variant Dim nextFree As Integer nextFree = FreeFile On Error GoTo fileDoesntSeemToExist Open strFile For Input As #nextFree getFileText = Input(LOF(nextFree), #nextFree) Close #nextFree success = True Exit Function fileDoesntSeemToExist: MsgBox "An error occurred while trying to open file " & _ strFile, vbExclamation, "Open" success = False End Function Public Sub setFileText(ByVal pathOf As String, ByVal textOf As String, Optional ByRef success As Boolean) Dim fFile As Integer fFile = FreeFile On Error GoTo sftCouldntWrite Open pathOf For Output As #fFile Print #fFile, textOf Close fFile success = True Exit Sub sftCouldntWrite: success = False End Sub Public Function repeatedReplace(ByVal parText As String, ByVal toFind As String, ByVal toReplace As String) As String Dim text As String Dim oldText As String text = parText Do oldText = text text = Replace$(text, toFind, toReplace) Loop Until text = oldText repeatedReplace = text End Function