DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
merhabalar ekli dosyanın içerisinde mail gönder butonu yer almaktadır, bu butona tıklandığında maili göndermesini istiyorum, yardımlarınız talep ederim.
Mail gönderme ile ilgili tam olarak yapmak istediğiniz işlem nedir?
Kişiye özel toplu mail mi, mutabakat mı? v.b.
Sayfayı mı? Excel dosyasını mı? Belirli bir alanı mı? mail göndermek istiyorsunuz?
Sub Test()
Dim OutlookApp As Object, OutlookMsg As Object
Dim FSO As Object
Dim BodyText As Object
Dim MyRange As Range
Dim TempFile As String
Dim strHTMLBody As String
Dim NoA As Long
NoA = Cells(65536, 1).End(xlUp).Row
TempFile = "D:\TempHTML.htm"
Set FSO = CreateObject("Scripting.FilesystemObject")
Set MyRange = ActiveSheet.Range("A1" & ":B" & NoA)
If MyRange Is Nothing Then Exit Sub
ActiveWorkbook.PublishObjects.Add _
(4, TempFile, MyRange.Parent.Name, MyRange.Address, 0, "", "").Publish True
Set BodyText = FSO.OpenTextFile(TempFile, 1)
strHTMLBody = strHTMLBody & BodyText.ReadAll
' Kill TempFile1
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMsg = OutlookApp.CreateItem(0)
With OutlookMsg
.HTMLBody = strHTMLBody
.Subject = "Bu e-postanın konusu falan filandır"
.To = "alibaba@ciftlik.com.tr"
.CC = "yedicuceler@masallardiyari.com; pamukprenses@masallardiyari.com"
'.Send
.display
End With
Set BodyText = Nothing
Set OutlookMsg = Nothing
Set OutlookApp = Nothing
Set MyRange = Nothing
Set FSO = Nothing
End Sub
Aşağıdaki kodu bir deneyin;
Kod:Sub Test() Dim OutlookApp As Object, OutlookMsg As Object Dim FSO As Object Dim BodyText As Object Dim MyRange As Range Dim TempFile As String Dim strHTMLBody As String Dim NoA As Long NoA = Cells(65536, 1).End(xlUp).Row TempFile = "D:\TempHTML.htm" Set FSO = CreateObject("Scripting.FilesystemObject") Set MyRange = ActiveSheet.Range("A1" & ":B" & NoA) If MyRange Is Nothing Then Exit Sub ActiveWorkbook.PublishObjects.Add _ (4, TempFile, MyRange.Parent.Name, MyRange.Address, 0, "", "").Publish True Set BodyText = FSO.OpenTextFile(TempFile, 1) strHTMLBody = strHTMLBody & BodyText.ReadAll ' Kill TempFile1 Set OutlookApp = CreateObject("Outlook.Application") Set OutlookMsg = OutlookApp.CreateItem(0) With OutlookMsg .HTMLBody = strHTMLBody .Subject = "Bu e-postanın konusu falan filandır" .To = "alibaba@ciftlik.com.tr" .CC = "yedicuceler@masallardiyari.com; pamukprenses@masallardiyari.com" '.Send .display End With Set BodyText = Nothing Set OutlookMsg = Nothing Set OutlookApp = Nothing Set MyRange = Nothing Set FSO = Nothing End Sub
Verdiği hata nedir ? Ben buradan sizin bilgisayarı göremiyorum
Belki sizin hard disk'de "D" bölümü yoktur. Kodun bu kısmını düzenleyin ....
TempFile = "C:\TempHTML.htm"