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
        Dim filenameX As String
        filenameX = "P:\gdace\MSDS\Yellow Armour Aqua Enamel Sheboygan 1 10.pdf"
    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
        End With
        Catch ex As Exception
            MsgBox("Email Sent to the Recipient")
        End Try
    End Sub
Dim strPath As String
        strPath = "Path to PDF File"
        Dim attMent As New System.Net.Mail.Attachment(strPat)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.