Command button and VBA Assistance
Hi
Newbie to word vba, have some excel vba experience but not an expert. I have developed a form, which is a basic active x form, only to be used during this virus. It's saved as a Word Macro enabled template. The command button on the form saves it and emails it as an attachment, which works great, see below, however the issue I have is that this saves the master form, which is saved on our network, which for Data Protection purposes, the business does not want to happen. I guess the question I have is how do I edit the code below, to in my thoughts, a save as before sending or clear down of the 2nd column of the table when closing...hope this makes sense.
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 = "ENTER SUBJECT LINE HERE"
.Body = "ENTER MESSAGE HERE" '& vbCrLf & _
'"BODY SECND LINE" & vbCrLf & _
'"BODY THIRD LINE"
.To = "ENTER RECIPIENT EMAIL HERE"
'.CC = "ENTER A CC EMAIL ADDRESS AND REMOVE COMMENT OUT TO MAKE LIVE"
Importance = olImportanceHigh
.Attachments.Add Doc.FullName
.Send
End With
Application.ScreenUpdating = False
Thanks in advance
|