Solved

Confirmation on Submit button for MS Word Form

Posted on 2014-03-26
1
1,907 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Like many others, we try and discourage users from printing documents unnecessarily and instead send or share them electronically. However, this doesn't always work and documents are still printed. With this simple solution, if the user tries to …
It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

803 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