Public objOutlook As Object
Public objNS As Outlook.Namespace
Public objMsg As Outlook.MailItem
Public objRecipient As Outlook.Recipient
Public strCurrentUser As String
Public strCurrentUserFull As String
Sub MailTest2()
Dim blnDone As Boolean
Dim x As Integer
Dim strSignature As String
Dim strReportDrive As String
Dim strReportDir As String
Set objOutlook = GetObject(, "Outlook.Application")
Set objNS = objOutlook.GetNamespace("MAPI")
Set objMsg = objNS.Application.CreateItem(olMailItem)
With objMsg
.Display
Set objRecipient = .Recipients.Add("Undisclosed Recipients")
objRecipient.Type = olCC
Set objRecipient = .Recipients.Add("
[email protected];
[email protected]")
objRecipient.Type = olBCC
.Subject = " This is a test"
.Body = "This test should work"
.Attachments.Add "L:\whatever.xls", , intChar + 1
.Body = .Body
.Send
End With
Set objRecipient = Nothing
Set objMsg = Nothing
Set objNS = Nothing
Set objOutlook = Nothing
MsgBox "EMAILS SENT!!!"
End Sub
Bookmarks