Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

command button in Excel worksheet with email and attachment

  Asked By: Cameron    Date: Nov 12    Category: MS Office    Views: 5502
  

I need to have a command button in the worksheet and have it send an
email with the existing worksheet (opened worksheet) as an attachment.

I can add an email hyperlink and then the user would manually insert
the document but I want to automated to minimize user intervention.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Steve Boyd     Answered On: Nov 12

Use the following macro and assign it to the button.

Sub Test()
Dim x As Outlook.Application
Dim y As Outlook.MailItem
Set x = CreateObject("Outlook.Application")
Set y = oLapp.CreateItem(0)
With y
.Subject = ""
.CC = ""
.To =
.Body =""
.Attachments.Add '(path to the attachment,either hard coded or
variable)
.Display
End With
Set x = Nothing
Set y = Nothing
End Sub

You have to enable the Microsoft Outlook x(is the version) Library
from Tools-References in your VB Editor to be able to use this.

 
Answer #2    Answered By: Raul Clark     Answered On: Nov 12

You have been extremely helpful. I appreciate you
taking the time to pass on this information.

 




Tagged: