BrianExcel
Well-known Member
- Joined
- Apr 21, 2010
- Messages
- 975
Hi folks,
If I have a file already copied to the clipboard, how do I get that file into the body of an outlook message?
Assuming I already have the file (it's a picture) how would I get it into the body below?
If I have a file already copied to the clipboard, how do I get that file into the body of an outlook message?
Assuming I already have the file (it's a picture) how would I get it into the body below?
Code:
Sub Email()
Dim OutApp As Object, OutMail As Object
Dim Email As String, Center As String
On Error Resume Next
Set frmCenterLookup.MultiPage1.Pages(2).Picture2 = Clipboard.GetData(vbCFMetaData)
Err.Clear
On Error GoTo Email_Error
Email = frmCenterLookup.txtDevelopmentManager.Value
Center = frmCenterLookup.txtCenterConfirm.Value
Set rng = Nothing
On Error Resume Next
On Error GoTo 0
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = Email & "TEST"
.Subject = "Center " & Center & " Inquiry"
.HTMLBody = [COLOR="Red"]<--- I need to insert file here[/COLOR]
.Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Email_Exit:
Set OutMail = Nothing
Set OutApp = Nothing
On Error GoTo 0
Exit Sub
Email_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Email of Module EmailCode"
Err.Clear
GoTo Email_Exit
End Sub