Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Save and Send worksheet as an attachment

0

Hi! So, I'm pretty new to writing macros. I created a button in my excel worksheet to attach the worksheet to an email. I'm looking for a way to save it to the desktop of whoever is sending it and reference cell A1 for the filename. Also, I'm looking to have a questions box popup with text and values before the user sends the email. Below is what I have so far. Thanks in advance!

Sub Email_From_Excel_Attachments()

Dim emailApplication As Object

Dim emailItem As Object

Set emailApplication = CreateObject("Outlook.Application")

Set emailItem = emailApplication.CreateItem(0)

emailItem.to = "email adrress"

emailItem.bcc = 

emailItem.Subject = Range("A1").Value

emailItem.Body = "1.) Question." & vbCrLf & vbCrLf & "2.) Question."

emailItem.Attachments.Add ActiveWorkbook.FullName

emailItem.Display

Set emailItem = Nothing

Set emailApplication = Nothing

End Sub

Answer
Discuss

Discussion

This looks like a request for free coding. This site tries to teach Excel. If there is something you wish to learn please rephrase your question to make yourn point.
Variatus (rep: 4889) Apr 21, '20 at 8:34 pm
Add to Discussion



Answer the Question

You must create an account to use the forum. Create an Account or Login