- Katılım
- 27 Şubat 2008
- Mesajlar
- 307
- Excel Vers. ve Dili
- Office 2016
aşağıdaki gibi bir kodum var ama yanlış giden şu; dosya eklerken her zaman dosya adı değişiyor. Bende dosya adını isim koduyla belirttim. Fakat ekleme kısmında nasıl yapacağımı bilemedim
Private Sub CommandButton2_Click()
sor = MsgBox("e posta Göndermek İstiyor Musunuz ?", vbYesNo)
If sor = vbNo Then Exit Sub
kullanici_sahibi = ""
kullanici_parola = ""
Set objEmail = CreateObject("CDO.Message")
objEmail.From = kullanici_sahibi
objEmail.To = "" 'Gönderilecek e-mail adresi
isim = Sheets("VAKA CETVELİ (VAR İSE)").[aa1] & " " & "KIZAMIK VAKA FORMU"
objEmail.Subject = "KIZAMIK VAKA FORMU"
objEmail.TextBody = "KIZAMIK VAKA FORMU"
objEmail.AddAttachment "Masaüstü\isim.pdf"
With objEmail.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = kullanici_sahibi
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = kullanici_parola
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "eposta.saglik.gov.tr"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Update
End With
objEmail.Send
MsgBox "'den DOSYA MAİL OLARAK GÖNDERİLMİŞTİR"
End Sub
Private Sub CommandButton2_Click()
sor = MsgBox("e posta Göndermek İstiyor Musunuz ?", vbYesNo)
If sor = vbNo Then Exit Sub
kullanici_sahibi = ""
kullanici_parola = ""
Set objEmail = CreateObject("CDO.Message")
objEmail.From = kullanici_sahibi
objEmail.To = "" 'Gönderilecek e-mail adresi
isim = Sheets("VAKA CETVELİ (VAR İSE)").[aa1] & " " & "KIZAMIK VAKA FORMU"
objEmail.Subject = "KIZAMIK VAKA FORMU"
objEmail.TextBody = "KIZAMIK VAKA FORMU"
objEmail.AddAttachment "Masaüstü\isim.pdf"
With objEmail.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = kullanici_sahibi
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = kullanici_parola
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "eposta.saglik.gov.tr"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
.Update
End With
objEmail.Send
MsgBox "'den DOSYA MAİL OLARAK GÖNDERİLMİŞTİR"
End Sub
