I am using this code to send a report and the mail is not automaticaly sent beacuse i need to controll the mail before i send it. Now i want to use my code to automatically create an mail with an attached file. I have found some code in this forum but the problem is that i want to autmatically create but not send it....
Sub mail_wassum()
Dim oWorkSpace As Object, oUIDoc As Object, Notes As Object
Dim stTo As String, stCC As String, stSubject As String, stBody As String
Dim rnBody As Range
Dim lnRetVal As Long
lnRetVal = FindWindow("NOTES", vbNullString)
If lnRetVal = 0 Then
MsgBox "Lotus Notes måste vara öppnat.", _
vbInformation, "Systemfel-Lotus Notus"
Exit Sub
End If
Application.ScreenUpdating = False
Set oWorkSpace = CreateObject("Notes.NotesUIWorkspace")
stTo = "vp.prices@wassum.com,"
stCC = ""
stSubject = "Luxkurser" & " " & Date
'För att få en radbrytning i förhållande till den inklistrade bilden.
stBody = "Med vänlig hälsning"
Workbooks("Navcenter").Sheets("Data till Wassum").Activate
Range("A1:F9").Copy
On Error Resume Next
Set oUIDoc = oWorkSpace.composeDocumen _("W19723/EJBY/DDB", "DEPTMAIL\4253R4253BAC.nsf", "Memo")
On Error GoTo 0
Set oUIDoc = oWorkSpace.CurrentDocument
Call oUIDoc.FieldSetText("EnterSendTo", stTo)
Call oUIDoc.FieldSetText("EnterCopyTo", stCC)
Call oUIDoc.FieldSetText("Subject", stSubject)
Call oUIDoc.FieldSetText("Body", stBody)
Call oUIDoc.GoToField("Body")
Call oUIDoc.Paste
Set oUIDoc = Nothing
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
MsgBox "E-post har skapats,sparats men inte sänts iväg.", vbInformation
AppActivate ("Notes")
End Sub
Sub mail_wassum()
Dim oWorkSpace As Object, oUIDoc As Object, Notes As Object
Dim stTo As String, stCC As String, stSubject As String, stBody As String
Dim rnBody As Range
Dim lnRetVal As Long
lnRetVal = FindWindow("NOTES", vbNullString)
If lnRetVal = 0 Then
MsgBox "Lotus Notes måste vara öppnat.", _
vbInformation, "Systemfel-Lotus Notus"
Exit Sub
End If
Application.ScreenUpdating = False
Set oWorkSpace = CreateObject("Notes.NotesUIWorkspace")
stTo = "vp.prices@wassum.com,"
stCC = ""
stSubject = "Luxkurser" & " " & Date
'För att få en radbrytning i förhållande till den inklistrade bilden.
stBody = "Med vänlig hälsning"
Workbooks("Navcenter").Sheets("Data till Wassum").Activate
Range("A1:F9").Copy
On Error Resume Next
Set oUIDoc = oWorkSpace.composeDocumen _("W19723/EJBY/DDB", "DEPTMAIL\4253R4253BAC.nsf", "Memo")
On Error GoTo 0
Set oUIDoc = oWorkSpace.CurrentDocument
Call oUIDoc.FieldSetText("EnterSendTo", stTo)
Call oUIDoc.FieldSetText("EnterCopyTo", stCC)
Call oUIDoc.FieldSetText("Subject", stSubject)
Call oUIDoc.FieldSetText("Body", stBody)
Call oUIDoc.GoToField("Body")
Call oUIDoc.Paste
Set oUIDoc = Nothing
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
MsgBox "E-post har skapats,sparats men inte sänts iväg.", vbInformation
AppActivate ("Notes")
End Sub