newbie2vba2today
New Member
- Joined
- Mar 23, 2023
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
I have a cell range of B2:I17 that I want to copy and paste as an image into the email body and include the workbook as an attachment in an email. I am not good with VBA code but here is what I have so far. I am treating this range in the worksheet like a form that will be filled out. I want this to be in VBA so that I can attach it to a Active X button so that once the form is complete, a user will be able to click the button and it will automatically copy the range and send it in an email. Please help if you can.
Sub AttachWorkbookIntoEmailMessage()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.to = ""
.Subject = ""
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Send 'Send email, change to send to send straight away use
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
Sub AttachWorkbookIntoEmailMessage()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
.to = ""
.Subject = ""
.Body = ""
.Attachments.Add ActiveWorkbook.FullName
.Send 'Send email, change to send to send straight away use
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub