hi guys!
I'm not good with VBA so I need help amending this code.
I was trying to create macro to send form to specific email. this code works but I'm struggling to find a way to send only one sheet instead of full workbook. I tried replacing thisWorkbook with ThisWorkbook.worksheets("Form") but that didn't work.
can anybody please help me?
I'm not good with VBA so I need help amending this code.
I was trying to create macro to send form to specific email. this code works but I'm struggling to find a way to send only one sheet instead of full workbook. I tried replacing thisWorkbook with ThisWorkbook.worksheets("Form") but that didn't work.
can anybody please help me?
>>> start to use ' code - tags ', which have noticed for You many times <<<
Posting a sample workbook
The Chandoo.org Forum now has the facilities to upload files directly into a post. Simply use either the Media icon in the Edit menu or the Upload a File Button next to the Save Changes button Alternatively In the Chandoo.org Blog or here in the Forums you can still upload files using a Free...
chandoo.org
Code:
Sub send_mail()
Dim outlookOBJ As Object
Dim mItem As Object
Set outlookOBJ = CreateObject("Outlook.application")
Set mItem = outlookOBJ.createItem(olMailItem) With mItem
.to = "miketheemperor@gmail.com"
.Subject = "test" .body = "test"
.attachments.Add ThisWorkbook.path & "\" & ThisWorkbook.Name
.display
End With
End Sub
Last edited by a moderator: