• Privacywetgeving
    Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.

De inhoud van de huidige rij versturen naar outlook

Status
Niet open voor verdere reacties.

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
 
De string "inhoud" zou de waarde moeten bevatten van alle cellen in de huidige rij

ga naar eerste kolom
inhoud = 1 cel + inhoud
volgende kolom
enz.
 
Sub test()

Dim column As Integer
Dim str As String

column = 1
While (Cells(ActiveCell.Row, column) <> "")
If Not str = "" Then
str = str & "/"
End If
str = str & Cells(ActiveCell.Row, column)
column = column + 1
Wend
MsgBox str

End Sub


Dit bracht de oplossing !!

Bedankt voor de hulp!
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan