Word Word Macro to Save & Send Email - Need Help!!

Oct 29, 2009
Reaction score
I am using the following code to email word document (its actually a form) as attachment and to save it to my "P:/" drive. It seems working but the code will need to modify for the following reasons:

  1. Once I am done filling out the form and hit the command button to run the macro… the document (form) actually sent to email and also saved to my "P:/" drive successfully but its over saved the master file. I need the form to be blank at all time.
  2. Also, I want to have the files to be stamp with date and time (as a file name for the form) that going to be email and save to "p:/" drive.
I will appreciate any help. Thanks!!

The code I am using is:

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


With EmailItem

.Subject = "Insert Subject Here"

.Body = "Insert message here" & vbCrLf & _

"Line 2" & vbCrLf & _

"Line 3"

.To = "(e-mail address removed)"

.Importance = olImportanceNormal 'Or olImprotanceHigh Or olImprotanceLow

.Attachments.Add Doc.FullName


End With

Application.ScreenUpdating = True

Set Doc = Nothing

Set OL = Nothing

Set EmailItem = Nothing

Flag = True

sPath = "P:\"

ActiveDocument.SaveAs FileName:=sPath & ActiveDocument.Name

Flag = False


CommandButton1.Visible = False

End Sub



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads