View Single Post
 
Old 09-10-2018, 02:00 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Personally I would add a ribbon tab to the document to hold the submit button, however the following will disable and change the caption on the submit button.



Code:
Private Sub SubmitButton1_Click()
'Label1.Visible = True
Dim OL              As Object
Dim EmailItem       As Object
Dim Doc             As Document
 
Application.ScreenUpdating = False
Set OL = CreateObject("Outlook.Application")
Set EmailItem = OL.CreateItem(0)
Set Doc = ActiveDocument
SubmitButton1.Enabled = False
SubmitButton1.Caption = "Form submitted"
Doc.Save
 
With EmailItem
    .Subject = "Form submitted"
    .Body = ""
    .To = "none@none.com"
    .Importance = 1
    .Attachments.Add Doc.FullName
    .Send
End With
 
Application.ScreenUpdating = True
 
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote