Wysyłanie poczty przy użyciu programu Outlook, w którym nie działa metoda wysyłania
Używam tego kodu do wysyłania wiadomości e-mail z programu Excel:
Sub Mail_workbook_Outlook_1()
'Working in Excel 2000-2013
'This example send the last saved version of the Activeworkbook
'For Tips see: http://www.rondebruin.nl/win/winmail/Outlook/tips.htm
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = "[email protected]"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send ' <--------------------------------This is causing troubble
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Problemem jest.Send
nie jest rozpoznawany jako obiekt (lub metoda).
Inne polecenia działają (tj. Wyświetl, Zapisz).
Wierzę, że ten błąd istnieje z powodu systemów bezpieczeństwa w mojej pracy. Próbowałem nawet użyć CDO i nie działa on w eterze.