inderdaad
10-26-2017, 02:45 AM
Hello,
in the code below I replaced .display with .Send
It generates a mail but the body stays empty
Selection.Copy
'Dim weekday As Integer
'weekday = Range("B3").Value
'If weekday = 3 Then
'Range("D3").Select
'Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
'Else: Range("D2").Select
'Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
'End If
Dim OutApp As Object
Dim OutMail As Object
Dim olInsp As Object
Dim oRng As Object
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If Err <> 0 Then Set OutApp = CreateObject("Outlook.Application")
On Error GoTo 0
Set OutMail = OutApp.CreateItem(0)
With OutMail
.BodyFormat = 3
.To = Sheets("Lijst Bestellingen").Range("B4")
.CC = ""
.BCC = ""
.Subject = "Nieuwe bestelling"
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.collapse 1
oRng.Paste
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
Any ideas
Looking forward
in the code below I replaced .display with .Send
It generates a mail but the body stays empty
Selection.Copy
'Dim weekday As Integer
'weekday = Range("B3").Value
'If weekday = 3 Then
'Range("D3").Select
'Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
'Else: Range("D2").Select
'Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
'End If
Dim OutApp As Object
Dim OutMail As Object
Dim olInsp As Object
Dim oRng As Object
On Error Resume Next
Set OutApp = GetObject(, "Outlook.Application")
If Err <> 0 Then Set OutApp = CreateObject("Outlook.Application")
On Error GoTo 0
Set OutMail = OutApp.CreateItem(0)
With OutMail
.BodyFormat = 3
.To = Sheets("Lijst Bestellingen").Range("B4")
.CC = ""
.BCC = ""
.Subject = "Nieuwe bestelling"
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.collapse 1
oRng.Paste
.Display
End With
Set OutMail = Nothing
Set OutApp = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
Set oRng = Nothing
Any ideas
Looking forward