Skip to main content

AccessTr.neT


Outlook İle Gönderme Makrosunda Attachments Opsiyonu Hatası

tarkanaykın
tarkanaykın
3
227

Outlook İle Gönderme Makrosunda Attachments Opsiyonu Hatası

Çözüldü #1
merhaba arkadaşlar, bulduğum bir kodu kendime göre uyarladım; outlook üzerinden hem mesaj hem de ek gönderiyor, karar değiştirdim sadece mesaj göndermek istedim işte bu yüzden Attachments.Add ("xxxxx") kısmını iptal ettim bu kez hiç mesaj göndermedi, ne alakası var bu bir seçenek değil mi? ben sadece mesaj göndersin istiyorum ama bu kısım, mesajı göndermeme engel oluyor, bunu nasıl düzeltebiliriz acaba?

Sub Email_CurrentWorkBook()
Dim Makro As Object
Dim Mail As Object
Set Makro = CreateObject("Outlook.Application")
Set Mail = Makro.CreateItem(0)
On Error Resume Next
With Mail
.To = Range("c5").Value
.CC = ""
.BCC = ""
.Subject = "Örnek"
.Body = "örnektir"
'.Attachments.Add ("C:\Users\xxxxxx\Desktop\deneme.pdf") tik atıp devre dışı bıraktım
.Send
End With
On Error GoTo 0
Set Mail = Nothing
Set Makro = Nothing
End Sub
Cevapla
#2
Dim OutlookApp As Outlook.Application
  Dim OutlookMail As Outlook.MailItem

  Set OutlookApp = New Outlook.Application
  Set OutlookMail = OutlookApp.CreateItem(olMailItem)
 
  With OutlookMail
    .BodyFormat = olFormatHTML
    .Display
    .HTMLBody = "mesajınız"
    .To = "zzz@xxx.com"
    .CC = "[email protected]"
    .BCC = "[email protected]"
    .Subject = "Konunuz"
    .Attachments = "eklentiniz"
    .Send
  End With
olarak deneyin.


objectler için set nothing düzenlemelerini bu kodu esas alarak yapın belirtmeyi unutmuşum. Kodunuzda error handlerınızda sorunlu kodları tanımlı değil.
Cevapla
#3
Çok teşekkür ederim sayın atoykan, bu iş de tamam, çalıştı, kolay gelsin. Img-grin
Cevapla
#4
Rica ederim. İyi çalışmalar.
Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da