Hi everybody.
I am new to this forum and relevently new to vba in Excel.
What I need help with is i have a userform which sends an email with selected textboxes within the userform and this gets attached to the body of the email. However I would like it to also attach the image which is either stored in the userform or from a stored storage location on our server.
Below is the current code any idea? would be greatly appreciated thanks
Dim oSess As Object
Dim oDB As Object
Dim oDoc As Object
Dim oItem As Object
Dim Direct As Object
Dim Var As Variant
Dim flag As Boolean
Set oSess = CreateObject("Notes.NotesSession")
Set oDB = oSess.GETDATABASE("", "")
Call oDB.OPENMAIL
flag = True
If Not (oDB.IsOpen) Then flag = oDB.Open("", "")
If Not flag Then
Set oDB = oSess.GETDATABASE("", "Mail2/" & oDB.FILEPATH)
'MsgBox "Can't open mail file: " & oDB.SERVER & " " & oDB.FILEPATH
'GoTo exit_SendAttachment
End If
On Error GoTo err_handler
Set oDoc = oDB.CREATEDOCUMENT
Set oItem = oDoc.CREATERICHTEXTITEM("BODY")
oDoc.Form = "Memo"
oDoc.Subject = "New - Cost Reduction Idea "
oDoc.sendto = "Clive@y.com"
oDoc.CopyTo = "Clive@Z.com"
oDoc.body = "Please process the below Cost Reduction Idea" & Chr(10) & Chr(10) & "Date: " & TextBox1 _
& Chr(10) & Chr(10) & "Name of requester: " & TextBox3 & Chr(10) & Chr(10) & "WWID of requester: " & TextBox4 _
& Chr(10) & Chr(10) & "Requesters Idea / Suggestion: " & TextBox5 & Chr(10) & Chr(10) & " Thank you "
oDoc.postdate = Date
oDoc.SaveMessageOnSend = True
oDoc.visable = True
'Sending Message
oDoc.SEND False
exit_SendAttachment:
On Error Resume Next
Set oSess = Nothing
Set oDB = Nothing
Set oDoc = Nothing
Set oItem = Nothing
'Done
err_handler:
If Err.Number = 7225 Then
MsgBox "File doesn't exist"
Else
'MsgBox Err.Number & " " & Err.Description
End If
On Error GoTo exit_SendAttachment
MsgBox "Your Cost Reduction Idea has been sent thank you"
ActiveWorkbook.Close Savechanges:=False
Bookmarks