• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Attaching and emailing excel document via a button click

Soh

New Member
good day ,

I'm trying to create an Excel registration form where people can put their details e.g. name , surname and click a send button , which will than attached an active Excel registration form and send it to me via outlook after sending it should than inform the user that the application was sent successfully. Below is my little VB code which works under Microsoft word but NOT under excel , can you guys assist please with something that will work under excel as per my requirements.
my code

Code:
Dim OL  As Object
Dim EmailItem  As Object
Dim Doc  As Document
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(olMailItem)
Set Doc = ActiveDocument
Doc.Save
With EmailItem
.Subject = "Training Registration for Submitted"
.Body = "Good day " & vbCrLf & _
"I would Like to attend the PLC1 Course as per the attached Excell Registration form" & vbCrLf & _
"Thanks Regards"
.To = "soh.mntambo@gmail.com"
.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow
.Attachments.Add Doc.FullName
.Send
End With
Application.ScreenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

Thanks
Soh
 
Last edited by a moderator:
Back
Top