- Katılım
- 2 Temmuz 2009
- Mesajlar
- 542
- Excel Vers. ve Dili
- office 2019 Türkçe
- Altın Üyelik Bitiş Tarihi
- 28/12/2022
arkadaşlar günaydın. bir mutabakat formu dosyam var. bunu makroyla (buton ile) mail atmak istiyorum. ama kodun bir satırında hata mesajı veriyor. sanırım işyerinde mail sunucu ayarıyla ilgili bir sorun.yardımcı olursanız sevinirim. teşekkürler....
Sub Mail_Range_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2010
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set rng = Nothing
On Error Resume Next
Set rng = Sheets("Bs form").Range("A1:I32").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = ThisWorkbook.Sheets("Bs form").Range("H55").Value
.CC = ""
.BCC = ""
.Subject = "BA/BS MUTABAKATI HK. Lütfen mail ile cevap veriniz."
.HTMLBody = RangetoHTML(rng)
.Send 'or use .Send
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
.HTMLBody = RangetoHTML(rng) satırında hata veriyor.
Sub Mail_Range_Outlook_Body()
' Don't forget to copy the function RangetoHTML in the module.
' Working in Office 2000-2010
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set rng = Nothing
On Error Resume Next
Set rng = Sheets("Bs form").Range("A1:I32").SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If rng Is Nothing Then
MsgBox "The selection is not a range or the sheet is protected" & _
vbNewLine & "please correct and try again.", vbOKOnly
Exit Sub
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.to = ThisWorkbook.Sheets("Bs form").Range("H55").Value
.CC = ""
.BCC = ""
.Subject = "BA/BS MUTABAKATI HK. Lütfen mail ile cevap veriniz."
.HTMLBody = RangetoHTML(rng)
.Send 'or use .Send
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
.HTMLBody = RangetoHTML(rng) satırında hata veriyor.