ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   eMail problem (https://www.excelbanter.com/excel-programming/327081-email-problem.html)

Jos Vens[_2_]

eMail problem
 
I have 2 questions:

- mail via Outlook Express with compression works but the attachment is not
added
- the reply to option in Outlook (eMail.ReadReceiptRequested = vReplyTo)
gives an error

Can you help me?
Thanks
Jos Vens

here's my code


Function MAIL_Mail() '(vFile As String) 'vFile = Bestandsnaam, zonder
extensie van het bestand

Dim oOutlook ', vMapi

Set oOutlook = CreateObject("Outlook.Application")
'Set vMapi = oOutlook.GetNameSpace("MAPI")

Set eMail = oOutlook.CreateItem(0)

vRecipient = "
vSubject = "MXLibra Punten " & pTransfer & " toegestuurd door " &
sParameters.[gUser]
vBody = "Libra Punten " & pTransfer & " toegestuurd door " &
sParameters.[gUser]
vAttachment = pTransfer & ".gz"
vReplyTo = "

Select Case sParameters.[nMX]
Case 1 'Outlook

eMail.Recipients.Add (vRecipient)
eMail.Subject = vSubject
eMail.Body = vBody
eMail.Attachments.Add (pFTransfer & vAttachment)
' eMail.ReadReceiptRequested = vReplyTo

eMail.Send

' Shell sParameters.[pFileMX], vbMaximizedFocus

Case 2 'Outlook Express with compression

vMail = "mailto:" & vRecipient & "?subject=" & vSubject & "&body="
& vBody & "&attachment=" & pFTransfer & vAttachment
ActiveWorkbook.FollowHyperlink vMail

Case 3 'Outlook Express without compression

Workbooks.Open (pTransfer & vExt), False, True
Windows(vFile & vExt).Visible = False
Workbooks(vFile & vExt).SendMail vRecipient, "Libra Punten " &
vFile & " (" & vVak & ") toegestuurd door " & sParameters.[gUser], True
Workbooks(vFile & vExt).Close SaveChanges:=False

Shell sParameters.[pFileMX], vbMaximizedFocus

End Select

End Function




All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com