outlook : send email : wait for an answer

  • Thread starter Thread starter Bre-x
  • Start date Start date
B

Bre-x

Guest
Good Morning,

I have this code that when run it launches MS Outlook and the only thing you have to do is to click send.

I would like to change it so that it loops through a set of records but it should not move to the next record until I click send on outlook. Can it be done? can my code request a acknowledgement from outlook?

Thank you all


Private Sub do_email_curr(the_email As String, the_pdf As String, the_inv As String)
Dim Outlook As Microsoft.Office.Interop.Outlook.Application
Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
Dim MMsg As String = "Please find attached Invoice, bla bla bla"

Outlook = New Microsoft.Office.Interop.Outlook.Application()
Mail = Outlook.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
Mail.To = the_email
Mail.Subject = "Invoice : " & the_inv
Mail.Attachments.Add(the_pdf)
Mail.Body = MMsg
Mail.ReadReceiptRequested = True

Mail.Display()
Outlook = Nothing
ReleaseComObject(Outlook)
End Sub

Private Sub ReleaseComObject(ByVal obj As Object)
Try
System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
obj = Nothing
Catch ex As Exception
obj = Nothing
End Try
End Sub

Continue reading...
 
Back
Top