Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2264
  • Last Modified:

Confirmation on Submit button for MS Word Form

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
SFrongillo
Asked:
SFrongillo
1 Solution
 
Chris BottomleyCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now