Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16039

VS 2010 Big failure when trying to put a .pdf in the outbox tray of outlook

$
0
0
Hello,

I have to start by saying that I have a Microsoft Office 365 subscription.

In an app I am developing, I coded to put a pdf file in the Outbox tray of OutLook, but this task was a complete disaster. It not only happens I could not set the file in the outbox tray, after the attempt, I am receiving an error when trying to open OutLook, which says that "The set of folders can not be opened. "

Sure need help.

This is the code:

HTML Code:

  Sub SENDDOC()
        Try
            Dim ol As New Outlook.Application()
            Dim ns As Outlook.NameSpace
            Dim fdMail As Outlook.MAPIFolder

            ns = ol.GetNamespace("MAPI")
            ns.Logon(, , True, True)

            Dim newMail As Outlook.MailItem

            fdMail = ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)

            newMail = fdMail.Items.Add(Outlook.OlItemType.olMailItem)
            newMail.Subject = SUBJECT_Mail()

            Dim attachment As System.Net.Mail.Attachment
            attachment = New System.Net.Mail.Attachment("C:\SINFOAD\SINFOAD\pdf\Temp.pdf")
            newMail.Attachments.Add(attachment)

            newMail.Body = "Se anexa el informe indicado en asunto, se agradece tomar nota del envío. Saludos."

            newMail.To = TO_Mail()

            If TheForm = "DPA002" Or TheForm = "DPA003" Then
                newMail.CC = CC_Mail()
            End If
           
            newMail.SaveSentMessageFolder = fdMail

            newMail.Send()

        Catch ex As Exception
            Throw ex
           
            GoTo 10

        End Try

        MsgBox("Por favor, diríjase a Outlook para completar el envío." + vbNewLine + vbNewLine + "Recuerde seleccionar la cuenta o correo de salida.", vbOKOnly + vbInformation, "DOCUMENTO EN OUTLOOK")

10:

End Sub

Thanks in advance for your help.

Nelson

Viewing all articles
Browse latest Browse all 16039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>