• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Kill.FullName hatası

Katılım
4 Ekim 2007
Mesajlar
632
Excel Vers. ve Dili
OFFİCE 365
Arkadaşlar merhaba. Aşağıdaki makroyu bu siteden temin etmiştim, çalışıyordu fakat şimdi hata vermeye başladı. Makronun sonlarına doğru yazan Kill.FullName satırını işaretleyip hata veriyor. Argument not optional hatası veriyor. Sorunu çözemedim yardımcı olursanız çok sevinirim. Şimdiden yardımlara çok teşekkür ederim.





Sub mail()
Sheets("LİSTE").Select
MsgBox "MAIL GÖNDERİLİYOR.!!" & Chr(10) & Chr(10) & "LÜTFEN MAIL GÖNDERİLDİ" & Chr(10) & Chr(10) & "BİLGİSİNİ ALANA KADAR BEKLEYİNİZ.!!!", vbOKOnly
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim wb As Workbook
Dim i As Integer
' Dim strdate As String
' strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
For i = 1 To 1
ActiveSheet.Copy
Set wb = ActiveWorkbook

With wb
.SaveAs [aa1] & " " & "BÖLGE" & " " & ActiveSheet.Name & ".xls" '"Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls", xlExcel8
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = Cells(i, "ah")
.CC = ""
.BCC = ""
.Subject = [aa1] & " " & "BÖLGE" & " " & [aa2] & " SON TARİHLİ KARŞILAŞTIRMA RAPORU"
.Body = " BU MAIL " & " " & Now & " " & "TARİHİNDE GÖNDERİLMİŞTİR."
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display

End With
.ChangeFileAccess xlReadOnly
Kill.FullName
.Close False

End With
Next
MsgBox "MAIL GÖNDERİLDİ.!!", vbOKOnly
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing

End Sub
 
Deneyiniz.:cool:
Kod:
Kill .FullName
 
Örnek dosya eklerseniz belki daha iyi yardımcı oluruz. Aynı kodları aşağıdaki şekilde bende deneyim. Önce BÖLGE ismi ile bir belge oluşturuyor. Bunu maile ekliyor. Sonrasında mail atılınca siliyor.
Kod:
Sub mail()
Sheets("LİSTE").Select
MsgBox "MAIL GÖNDERİLİYOR.!!" & Chr(10) & Chr(10) & "LÜTFEN MAIL GÖNDERİLDİ" & Chr(10) & Chr(10) & "BİLGİSİNİ ALANA KADAR BEKLEYİNİZ.!!!", vbOKOnly
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Dim wb As Workbook
Dim i As Integer
' Dim strdate As String
' strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
For i = 1 To 1
ActiveSheet.Copy
Set wb = ActiveWorkbook

With wb
.SaveAs [aa1] & " " & "BÖLGE" & " " & ActiveSheet.Name & ".xls" '"Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls", xlExcel8
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = Cells(i, "ah")
.CC = ""
.BCC = ""
.Subject = [aa1] & " " & "BÖLGE" & " " & [aa2] & " SON TARİHLİ KARŞILAŞTIRMA RAPORU"
.Body = " BU MAIL " & " " & Now & " " & "TARİHİNDE GÖNDERİLMİŞTİR."
.Attachments.Add wb.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display

End With
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False

End With
Next
MsgBox "MAIL GÖNDERİLDİ.!!", vbOKOnly
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing

End Sub
 
Geri
Üst