VB Script to Send Multiple Attachments via Email
Help! I'm hoping that someone can point me to a VB script that will do a fairly simple task.
I have a Microsoft Access table that lists the full directory path for a number of files.
I am looking for a script that will create a new email message in Outlook that attaches each of the files listed in the table. The user will then input the recipient and subject, and can send the email from Outlook.
Any help would be greatly appreciated! Thanks in advance.
Loop not working
Ok, I've written some code that mostly works, but here's the problem: I have 3 files that come up in the query below. I want the code to insert those 3 files into the email as attachments. The code is inserting the first file 3 times, instead or inserting each of the 3 files. What am I doing wrong with my loop?
Private Sub EmailMarkedDocuments_Click()
Dim MyDB As Database
Dim MyRS As Recordset
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookAttach As Outlook.Attachment
Dim TheAttachment As String
If (DCount("[Description]", "CheckForMarkedQuery") < 1) Then
MsgBox "You must check at least one document in order to send the email.", 0, "CW Case Management System"
Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(0) 'olMailItem
Set MyDB = CurrentDb
Set MyRS = MyDB.OpenRecordset("CheckForMarkedQuery")
TheAttachment = MyRS![FilePath]
.Subject = "Documents from Colt / Wallerstein LLP for Matter: " & (DLookup("[MatterName]", "MatterList", "ID=Forms!CourtClipForm!CourtClipMatter"))
.HTMLBody = "Please see the attached documents."
Do Until MyRS.EOF
Set objOutlookAttach = .Attachments.Add(TheAttachment)
By Thomas Eyde in forum .NET
Last Post: 12-22-2001, 02:13 PM
Last Post: 02-06-2001, 12:58 AM
By Phong Tran in forum Web
Last Post: 01-23-2001, 07:55 PM
By Phong Tran in forum XML
Last Post: 01-22-2001, 03:59 PM
By John Knoop in forum ASP.NET
Last Post: 11-15-2000, 03:38 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center