我有一个脚本可以通过电子邮件将完成的表单发送给我,但是一旦用户单击提交按钮,我需要它来关闭表单。
这是我为电子邮件部分准备的脚本,但是一旦提交,我该如何更改以使其关闭?
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 = "Privacy Information Questionaire"
.Body = "Privacy Information Questionaire" & vbCrLf & _
"Body Line 2" & vbCrLf & _
"Body Line 3"
.To = "email@example.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