Hi Daniweb Community,
I have a application that opens a pdf viewer and I would like to email the current(one in the pdf viewer) as an attachment in Outlook. I have listed the code below that opens the pdf viewer and I have listed the code to send an email with Outlook. The problem is when I code to add an Attachment I cannot see where the viewer will let me add the attachment as the current or active document. Can someone help me on this?
' Here is the code that loads the document
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Form5 = Nothing
Form5.Show()
Dim filenameX As String
filenameX = "P:\gdace\MSDS\Yellow Armour Aqua Enamel Sheboygan 1 10.pdf"
Form5.AxAcroPDF1.LoadFile(filenameX)
End Sub
Here is the code to send the email I just don't know how to attach the current document.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oOApp As Microsoft.Office.Interop.Outlook.Application
Dim oOMail As Microsoft.Office.Interop.Outlook.MailItem
Dim oAddSig As Microsoft.Office.Interop.Outlook.Inspector
'Create the Application
oOApp = CreateObject("Outlook.Application")
oOMail = oOApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
oAddSig = oOMail.GetInspector
'Send the E-Mail to the Recipient
With oOMail
.To = "mbrown"
.CC = ""
.Subject = "MSDS Sheet E-Mail Test"
.Body = "Current MSDS Sheet"
.Attachments.Add()This is where I am getting stuck
.Send()
End With
Try
Catch ex As Exception
MsgBox("Email Sent to the Recipient")
End Try
End Sub