Guidolavespa
Gebruiker
- Lid geworden
- 1 dec 2001
- Berichten
- 152
Volgende code doet al bijna het juiste werk, maar ik krijg de inhoud van de huidige rij in excel niet in de body gecopiëerd. Iemand ?
' requires a reference to the Microsoft Outlook 8.0 Object Library
Sub SendEmail()
If MsgBox("Doorsturen van belangrijke service melding?", 36, "E-mail?") = vbNo Then Exit Sub
' creates and sends a new e-mail message with Outlook
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem, ToContact As Recipient
Dim inhoud As String
inhoud = Range("G5:G20").Copy 'dit moet de huige rij worden
Set OLF = GetObject("", "Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add ' creates a new e-mail message
With olMailItem
.Subject = "Belangrijke servicemelding !" ' message subject
Set ToContact = .Recipients.Add("XXXX@XXXXXXXXXX.com") ' add a recipient
.Body = "Belangrijke servicemelding !" & Chr(13) & "_______________________" _
& Chr(13) & Chr(13) & inhoud ' the message text with a line break
'
.OriginatorDeliveryReportRequested = True ' delivery confirmation
.ReadReceiptRequested = True ' read confirmation
.Save ' saves the message for later editing
.Send ' sends the e-mail message (puts it in the Outbox if you are working off-line)
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End Sub
' requires a reference to the Microsoft Outlook 8.0 Object Library
Sub SendEmail()
If MsgBox("Doorsturen van belangrijke service melding?", 36, "E-mail?") = vbNo Then Exit Sub
' creates and sends a new e-mail message with Outlook
Dim OLF As Outlook.MAPIFolder, olMailItem As Outlook.MailItem, ToContact As Recipient
Dim inhoud As String
inhoud = Range("G5:G20").Copy 'dit moet de huige rij worden
Set OLF = GetObject("", "Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
Set olMailItem = OLF.Items.Add ' creates a new e-mail message
With olMailItem
.Subject = "Belangrijke servicemelding !" ' message subject
Set ToContact = .Recipients.Add("XXXX@XXXXXXXXXX.com") ' add a recipient
.Body = "Belangrijke servicemelding !" & Chr(13) & "_______________________" _
& Chr(13) & Chr(13) & inhoud ' the message text with a line break
'
.OriginatorDeliveryReportRequested = True ' delivery confirmation
.ReadReceiptRequested = True ' read confirmation
.Save ' saves the message for later editing
.Send ' sends the e-mail message (puts it in the Outbox if you are working off-line)
End With
Set ToContact = Nothing
Set olMailItem = Nothing
Set OLF = Nothing
End Sub