Our Products
Classes
BMP
Crypto
CSVStrings
DataLogger
Dates
DebugRecorder
FileNameSet
FileSender
RDOConnectMaster
ReportAids
Sheller
StringSet
WEBUtilities
Modules
DAOLib
Globals
Registry
Programs
Batcher
HTMLGen
KillTime
TimedMessage
|
|
StringSet: This class implements a set of up to 26 substitutable strings and the Expand function which performs the substitutions within a string where the substitution points are identified by a shortcut character (% by default) and a single letter that identifies the string. PutString lets you set the value for a string while GetString lets you retrieve a previously set string. See the example below. |
 |
|
This piece of code is acting as a simple Mail Merge funtion. A file (Message.txt) containing a simple eMail message is being read, and processed once, for each person who is to receive the message. The message contains insertion points (StringSet references) for the eMail address, name, and phone number of the recipient. These insertion points are indicated, in the prototype message, as $A, $N, and $P. |
Type ReplType 'define UDT to hold recipient data
eMail as String
Name as String
Phone as String
End Type
Dim Repl as ReplType
Dim ss as StringSet 'declare our StringSet
FileName = "Message.txt"
Lngth = FileLen(FileName) 'get length of file
Strg = Space(Lngth) 'set up recepticle to hold file content
FileNum = FreeFile 'get an available file number
Set ss = New StringSet 'create the object
ss.ShortCut = "$" 'set StringSet reference character to $
Repl = NextAddressee 'get first addressee information
While Repl.eMail <> "" 'loop through all addressees
Call ss.PutString("A", Repl.eMail) 'set up eMail address substitutions, $A
Call ss.PutString("N", Repl.Name) 'set up name substitutions, $N
Call ss.PutString("P", Repl.Phone) 'set up phone number substitutions, $P
Open FileName For Binary As FileNum 'open the file
Get #FileNum, , Strg 'read entire file into Strg
Close #FileNum 'close the file
Msg = ss.Expand(Strg) 'perform the substitutions
Call SendMessage(Msg) 'send out the eMail message
Repl = NextAddressee 'get next addressee information
Wend
End Sub
|
|