Tores333
Altın Üye
- Katılım
- 26 Ocak 2017
- Mesajlar
- 37
- Excel Vers. ve Dili
- Microsoft 365 EN 64 bit
- Altın Üyelik Bitiş Tarihi
- 23-06-2025
Merhaba,
aşgıdaki kod ile mail gönderiyorum ancak, başta ek olarak sectiğim dosyanın içinden mailin konu baslıgında kullanmam gereken bilgiler var.
seçtiğim dosyadan hücre yolunu nasıl gösterebilirim?
aşgıdaki kod ile mail gönderiyorum ancak, başta ek olarak sectiğim dosyanın içinden mailin konu baslıgında kullanmam gereken bilgiler var.
seçtiğim dosyadan hücre yolunu nasıl gösterebilirim?
Kod:
Sub Mail_Gonder()
Dim Exc_File As Variant
Dim Outlook_App As Object
Dim Outook_Mail As Object
Exc_File = Application.GetOpenFilename("Excel Files, *.xlsx", 1, "Please select a file to send", True)
If TypeName(Exc_File) = "Boolean" Then
MsgBox "You never get one if you dont want to!", vbCritical
Exit Sub
End If
On Error Resume Next
Set Outlook_App = GetObject(, "Outlook.Application")
On Error GoTo 0
If Outlook_App Is Nothing Then Call Shell("Outlook.exe", vbHide)
Set Outlook_App = CreateObject("Outlook.Application")
Set OutLook_Mail = Outlook_App.CreateItem(0)
Mesaj = "TOTAL: " & ActiveWorkbook.Sheets("Daily Bookings").Range("AG17") & " TEUS = " & ActiveWorkbook.Sheets("Daily Bookings").Range("AH17") & " MT"
On Error Resume Next
With OutLook_Mail
.Display
.To = ""
.CC = ""
.BCC = ""
.Subject = "TURKEY TO CANADA SERV.//" & " " & ActiveWorkbook.Sheets("Daily Bookings").Range("A8").Value & " " & "- Forecasts" & " " & Format(Now, "dd.mm.yyyy")
.HTMLBody = "<br>" & "Good day," & "<br><br>" & Mesaj & "<br><br>" & "Best regards," & .HTMLBody
.Attachments.Add Exc_File
.Display
'.Send
End With
On Error GoTo 0
Set OutLook_Mail = Nothing
Set Outlook_App = Nothing
'MsgBox "Mail gönderim işlemi tamamlanmıştır.", vbInformation
End Sub