#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
Why is it important to leave that document 'unfilled out'? You literally did a SaveAs to a temp folder so that the original doc is already in its original state.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help to get a word document to send specific content via email using submit button | ActualJax | Word VBA | 2 | 07-06-2020 04:18 PM |
Submit Button Req that populates email address | phorsley | Word VBA | 1 | 10-17-2017 04:50 PM |
Infopath PDF attached to Form not showing in Email Submit | CliffEstel | Misc | 0 | 09-20-2016 11:04 AM |
Submit to Email Command Button | rob7676 | Word VBA | 0 | 08-20-2015 05:05 AM |
VBA Code for a SUBMIT button in a Word form | BlueMax | Word VBA | 3 | 08-07-2013 06:26 AM |