I used this code to send email through excel and got back an error message “User defined type not defined”. Any help would be much appreciated. Also if you know an easy way to send the last file saved as an attachment that would also be a big help
Thanks
Josh Jacob
Sub Send_Outlook_E_Mail()
Dim oOutlook As New Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim OMailitem As Outlook.Mailitem
Set oNameSpace = oOutlook.GetNamespace("MAPI"
oNameSpace.Logon '
Set OMailitem = oOutlook.CreateItem(olMailItem)
With OMailitem
.Subject = "Subject Text"
.Recipients.Add "mailaddress"
.Body = "Your body text here"
.Body = "more text here"
.Body = "more text here"
.send
End With
oNameSpace.Logoff
Set oNameSpace = Nothing
End Sub
Sub SendActiveBook()
ActiveWorkbook.HasRoutingSlip = False
With ActiveWorkbook.RoutingSlip
.Recipients = "somebody@domain.com"
.Subject = "Distribution: test.xls"
.Message = "Hello"
.Delivery = xlAllAtOnce
End With
ActiveWorkbook.Route
End Sub