I have written a program to loop through a table and gather email address, on each loop (each new email address) an email is sent with a series of attachments. My problem is that I recently downloaded a bunch of windows updates and now my emails won't send. I wasn't sure if anyone else was having the same issue or not. It worked perfectly fine until I ran the updates. I have a snipet of code attached below. I also know that it is the attachments causing a problem because as soon as I comment out the attachments it runs through just fine.
** On another note, when the program then errors and I click debug or end, a bunch of the letter "n" fills a couple lines and then just quits. **
Thanks in advance for your help!
Private Sub Command0_Click()
Dim myolApp As Outlook.Application
Dim myItem As Object
Dim myNameSpace As Object
Dim myFolder As Object
Dim myAttachments, myRecipient As Object
Dim recipient As String
Dim file_name As String
Dim mySubject As Object
Dim dbs As Object
Dim rst As Object
Dim rst2 As Object
Dim strSQL As String
Set db = CurrentDb
Set rst = db.OpenRecordset("emailtable", dbOpenDynaset)
rst.MoveFirst
Do While Not rst.EOF
'MsgBox (rst!Address)
'recipient = rst!Address
Set myolApp = CreateObject("Outlook.Application")
Set myItem = myolApp.CreateItem(olMailItem)
' This addresses it
myItem.To = rst!Address
'This gives it a subject
myItem.Subject = "test subject"
'This gives it the body
myItem.Body = "test body new"
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\NDA Agreement Request-new.doc")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\MCG Mutual Nondisclosure Agmt 2-19-08.pdf")
'Set myAtachments = myItem.Attachments.Add("C:\Documents and Settings\ss44151\Desktop\NDA 2\Recertification Letter.rtf")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\Supplier Technology Survey.doc")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\SUPPLIER CONTACT LIST 2007.xls")
'myItem.DeleteAfterSubmit = True
'This sends it!
myItem.Send
rst.MoveNext
Loop
End Sub
** On another note, when the program then errors and I click debug or end, a bunch of the letter "n" fills a couple lines and then just quits. **
Thanks in advance for your help!
Private Sub Command0_Click()
Dim myolApp As Outlook.Application
Dim myItem As Object
Dim myNameSpace As Object
Dim myFolder As Object
Dim myAttachments, myRecipient As Object
Dim recipient As String
Dim file_name As String
Dim mySubject As Object
Dim dbs As Object
Dim rst As Object
Dim rst2 As Object
Dim strSQL As String
Set db = CurrentDb
Set rst = db.OpenRecordset("emailtable", dbOpenDynaset)
rst.MoveFirst
Do While Not rst.EOF
'MsgBox (rst!Address)
'recipient = rst!Address
Set myolApp = CreateObject("Outlook.Application")
Set myItem = myolApp.CreateItem(olMailItem)
' This addresses it
myItem.To = rst!Address
'This gives it a subject
myItem.Subject = "test subject"
'This gives it the body
myItem.Body = "test body new"
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\NDA Agreement Request-new.doc")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\MCG Mutual Nondisclosure Agmt 2-19-08.pdf")
'Set myAtachments = myItem.Attachments.Add("C:\Documents and Settings\ss44151\Desktop\NDA 2\Recertification Letter.rtf")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\Supplier Technology Survey.doc")
'myItem.Attachments.Add ("C:\Documents and Settings\ss44151\Desktop\NDA 2\SUPPLIER CONTACT LIST 2007.xls")
'myItem.DeleteAfterSubmit = True
'This sends it!
myItem.Send
rst.MoveNext
Loop
End Sub
Last edited: