Help with submit button to email form
Hi,
I found a code that works to email a document back to me but it saves the document in the filled out state. Is there a way to clear the document after sending? 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.SaveAs FileName:=Environ("temp") & "" & Environ("username"), Fileformat:=wdFormatDocument, AddToRecentFiles:=True
With EmailItem
.Subject = "New Tool Request"
.Body = "" & vbCrLf & _
"" & vbCrLf & _
""
.To = ""
.Importance = olImportanceHigh
.Attachments.Add Doc.FullName
.Display
End With
Application.ScreenUpdating = True
Set Doc = Nothing
Set OL = Nothing
Set EmailItem = Nothing
End Sub
|