Solved

Confirmation on Submit button for MS Word Form

Posted on 2014-03-26
1
1,822 Views
Last Modified: 2014-04-10
I'm using the following code on a submit button in a MS Word form:
---------------------------------------------------------------------------------------
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 = "History Month Quiz"
    .Body = "Insert message here" & vbCrLf & _
    "Body Line 2" & vbCrLf & _
    "Body Line 3"
    .To = "Name@someplace.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
   
End Sub
------------------------------------------------------------------------
Is there code I can add that would pop up an confirmation as in "Your form has been submitted. Thanks!" and/or an email a confirmation to the submitter?

Using MS Word 2010 and Outlook 2010
0
Comment
Question by:SFrongillo
1 Comment
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 39956730
Initial thought the easiest would seem to be:

msgbox "Your form has been submitted. Thanks!"

For example immediately after the line:

Application.ScreenUpdating = True

Chris
2

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now