A little while ago whilst working on a project at work, I wanted to add a feature where an email could be sent out.

I wanted to add an application setting where the user can edit an email template and add certain keywords that would be replaced with relevant data.

I achieved this by creating a public function;

Public Function getStr(strLongData As String, strKey As String, strVal As String)

        strLongData = strLongData.Replace(strKey, strVal)

        Return strLongData
    End Function

The strKey would be my keywords for example %userid%, this would then be replaced with strVal with for example 310


Dim replacedlongstring As String
replacedlongstring = getStr("this is a long string for %userid%, and more string", "%userid%", "310")

Let me have your thoughts and how it works out for you. Contact me through the contact page, or comment below.