Attaching files to your message is accomplished by filling out the MAPIFile structure and updating the message header information to reflect the number of files that are attached. You treat the file attachments exactly as you do recipients, first updating the structure, then specifying the total number of attachments.
The following code sample shows how you can attach a file to an existing message.
'--------------------------------------------------- 'Establishing attached file counts '--------------------------------------------------- tMessage.FileCount = 1 ReDim tFiles(1) as MAPIFile tFiles(1).PathName = "C:\AUTOEXEC.BAT" tFiles(1).Reserved = 0& tFiles(1).Position = 1 tFiles(1).FileName = "" tFiles(1).FileType = ""
This attaches the file C:\AUTOEXEC.BAT to the message at the first position of the message. Don't forget, to successfully attach an object, you'll have to already have at least a single character in the text of the message.
Using this technique, you can export a set of data to an excel spreadsheet, attach the spreadsheet and send it to another system. On the other end, you'll reverse the process, saving the attachment to disk when the message is opened. You can then import the data from the file on disk, updating the remote system's database table(s).