Thread: [Solved] Macro for submit email
View Single Post
 
Old 12-26-2014, 01:56 PM
AmyScott AmyScott is offline Windows 8 Office 2013
Novice
 
Join Date: Dec 2014
Location: Flowood, MS
Posts: 2
AmyScott is on a distinguished road
Default Macro for submit email

I want to send my staff a timesheet with a submit button so they can fill it out and submit the completed excel spread sheet to myself as well as their direct supervisor and our HR department. I have created a submit button and attached a macro, but I just don't have the code right. I keep editing it and looking for extra examples online, but something is just not quite right. when I hit the submit button, I send an email with no attachment. My staff all use Outlook. This is my most recent stab ath VBC
Option Explicit
Sub SubmitButton()
Dim x As Outlook.Application
Dim y As Outlook.MailItem
Set x = CreateObject("Outlook.Application")
Set y = oLapp.CreateItem(0)
With y
.Subject = "Timesheet Submitted"
.CC = "themodernarc@gmail.com"
.To = "amycraig@familyhealthcareclinic.com"
.Attachments.Add "C:\Users\amy.craig\AppData\Local\Microsoft\Window s\INetCache\Content.Outlook\74BIHEUD\current submittable form.xlsx"
.Display
End With
Set x = Nothing
Set y = Nothing
End Sub


Thanks so much for help!

Last edited by AmyScott; 12-26-2014 at 02:06 PM. Reason: decided to include code
Reply With Quote