Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-28-2020, 06:45 AM
hassinrasool hassinrasool is offline How do you add a line from a fillable word document into a VBA that you are using to email out Windows 10 How do you add a line from a fillable word document into a VBA that you are using to email out Office 2010
Novice
How do you add a line from a fillable word document into a VBA that you are using to email out
 
Join Date: Sep 2020
Posts: 2
hassinrasool is on a distinguished road
Default How do you add a line from a fillable word document into a VBA that you are using to email out

Hi everyone,

How do you add a line from a fillable word document into a VBA that you are using to email out that said document?

I have a VBA but I want to enter the name of the person completing the form from a line in the form into the body text of the email. (if that makes sense)

my VBA is:

Private Sub CommandButton1_Click()
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 = "Referral"
Dim sMsgBody As String
sMsgBody = sMsgBody & "Dear Team" & vbCr & vbCr
sMsgBody = sMsgBody & "Please find attached my completed referral form for a woman to your services" & vbCr & vbCr
sMsgBody = sMsgBody & "Kind Regards," & vbCr


.body = sMsgBody
.To = "person@person.com"
.Importance = 1
.Attachments.Add Doc.FullName
.Send

End With

Application.ScreenUpdating = True

Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing

End Sub
Reply With Quote
 

Tags
vba word outlook email



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a fillable word template but not see what is not req'd to be filled in saved as document sjohnstone@edgeautomation Word 1 05-02-2017 10:05 AM
How do you add a line from a fillable word document into a VBA that you are using to email out Protect fillable word 2013 document metsmaniac Word 1 06-30-2016 12:35 PM
How do you add a line from a fillable word document into a VBA that you are using to email out Word 2010 - How to create a fillable document from a boilerplate document sheaters Word 2 05-04-2016 01:57 PM
How do you add a line from a fillable word document into a VBA that you are using to email out How to make uneditable but fillable document in word 2003? officeboy09 Word 1 01-22-2014 03:54 PM
How do you add a line from a fillable word document into a VBA that you are using to email out Put a document in word into a fillable form groovy chick Word 3 01-18-2012 04:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:42 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft