# Help with Replace function VBScript



## Kenzii (Nov 4, 2008)

Hi all,

I am trying to place a replace function into a VBscript. No matter where I place the function i cannot get it to read and replace the letters.

The script I am trying to configure is to use with email2db and it saves emails processed into a network share.

I am trying to replace : with - The reason being for this is the script I am using only saves up to a colon ) Obviously fowarded emails and RE emails have the colon straight after. So these script is not running past this point and the email shows as 0kb and is missing the rest of the subject title past the colon.

The replace function I am using is *Replace(fname,":","-")*

Please see below for the script


> ' Action Script
> ' This script will fire when the Trigger fires. Use it to perform custom actions.
> 
> Sub Main()
> ...


Thanks for your help. As Im completely lost with this.


----------



## mistavista (Aug 8, 2009)

I think you're using it in the wrong place. The filename is unlikely to contain colons so it seems you want to use "replace" on the email's contents?

Remove your Replace line as it does nothing (you aren't assigning the value anywhere) and put this in on the line a bit lower:

Print #Fn,MSG_Header(H) & ":" & Replace(MSG_HeaderValue(H), ":", "-")


If I have understood you correctly then this should do the trick.


----------

