basictypeuser
Technical User
Hope someone can help.
I have created a word document. And within the document I created a button to attach the current document and send it as an email. For some reason it only emails the attachment as a link and not an actual attachment. Here is the code used to send the message.
Public Sub CommandButton2_Click()
'Save the completed document.
ChangeFileOpenDirectory "C:\Temp\"
ActiveDocument.SaveAs FileName:="Camera_Maint_Support.doc", FileFormat:=wdFormatDocument, AddToRecentFiles:=True
'Create the reference to Outlook
Set appOutlook = CreateObject("Outlook.Application")
Set itmMail = appOutlook.CreateItem(olMailItem)
'Populate the mail and send
With itmMail
.To = "myaddress@net.net"
.Subject = "Maintenance Support Request"
.HTMLBody = "Service Request - Please respond to the individual listed on the Maintenance Support Request form"
.Attachments.Add "C:\Temp\Camera_Maint_Support.doc", olByValue, , "Your Document"
.Send
End With
'Close the mail objects
'Set itmMail = Nothing
'Set appOutlook = Nothing
'Close the document
'ActiveDocument.Close False
End Sub
I have created a word document. And within the document I created a button to attach the current document and send it as an email. For some reason it only emails the attachment as a link and not an actual attachment. Here is the code used to send the message.
Public Sub CommandButton2_Click()
'Save the completed document.
ChangeFileOpenDirectory "C:\Temp\"
ActiveDocument.SaveAs FileName:="Camera_Maint_Support.doc", FileFormat:=wdFormatDocument, AddToRecentFiles:=True
'Create the reference to Outlook
Set appOutlook = CreateObject("Outlook.Application")
Set itmMail = appOutlook.CreateItem(olMailItem)
'Populate the mail and send
With itmMail
.To = "myaddress@net.net"
.Subject = "Maintenance Support Request"
.HTMLBody = "Service Request - Please respond to the individual listed on the Maintenance Support Request form"
.Attachments.Add "C:\Temp\Camera_Maint_Support.doc", olByValue, , "Your Document"
.Send
End With
'Close the mail objects
'Set itmMail = Nothing
'Set appOutlook = Nothing
'Close the document
'ActiveDocument.Close False
End Sub