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:
Thanks in advance for your help.
Nelson
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
Nelson