Excel mail gönderme kısa yolu

cenqawer

Altın Üye
Katılım
23 Ocak 2021
Mesajlar
99
Excel Vers. ve Dili
Excel 2021 Pro Plus Türkçe
Altın Üyelik Bitiş Tarihi
18-10-2028
Merhaba Makro ile açılan mail display ekranını nerden kapata bilir veya iptal edebilirim bulamadım :)
 

Ekli dosyalar

TURKOLOG

Altın Üye
Katılım
13 Kasım 2008
Mesajlar
744
Excel Vers. ve Dili
2016 64 TR
Altın Üyelik Bitiş Tarihi
29-10-2026
Gönderme butonun altında vba dan bakın
Veya gönderme butonuna sağ tıklayıp makro ata diyip açılan penceren düzenle diyin
Makronun olduğu kısmi bulup
.Display yazısını
'.Display yaparsanız maili göstermeden gönderir.
 

cenqawer

Altın Üye
Katılım
23 Ocak 2021
Mesajlar
99
Excel Vers. ve Dili
Excel 2021 Pro Plus Türkçe
Altın Üyelik Bitiş Tarihi
18-10-2028
Şimdi exel olarak ekliyorum lütfen kafayı yiycem bi türlü ayarlayamadım kime kısmı tamam bilgi kısmı açıklama kısmı hepsi tamam fakat alt kısımda sadece g10 j25 arasını seçtiremedim bütün sayfayı kopyalıyor lütfen yardım
 

Ekli dosyalar

Katılım
24 Nisan 2005
Mesajlar
3,669
Excel Vers. ve Dili
Office 2016 EN 64 Bit
Altın Üyelik Bitiş Tarihi
25/05/2022
VBA referance ları işaretleyiniz.

225777

C#:
Sub mail_gonder()
      Dim alan As Range
      
      mailkonu = Range("B1").Value
      mail = Range("B2").Value
      mailcc = Range("B3").Value
      mailmesaj = Range("B4").Value
      
      sonsatir = Cells(Rows.Count, "G").End(3).Row
      If sonsatir < 10 Then sonsatir = 10
      
      Set alan = Range("G10:J" & sonsatir)
      Set OutApp = CreateObject("Outlook.Application")
      Set OutMail = OutApp.CreateItem(0)
      
      With OutMail
       .To = mail
       .CC = mailcc
       .Subject = mailkonu
       .Display
      
       'Hemen göndermek için
       '.send
       .HTMLBody = mailmesaj & RangetoHTML(alan) & .HTMLBody
       End With
      
      Set wrdEdit = Nothing
      Set OutMail = Nothing
      Set OutApp = Nothing
End Sub

Function RangetoHTML(rng As Range)
' Changed by Ron de Bruin 28-Oct-2006
' Working in Office 2000-2016
    Dim fso As Object
    Dim ts As Object
    Dim TempFile As String
    Dim TempWB As Workbook

    TempFile = Environ$("temp") & "\" & Format(Now, "dd-mm-yy h-mm-ss") & ".htm"

    'Copy the range and create a new workbook to past the data in
    rng.Copy
    Set TempWB = Workbooks.Add(1)
    With TempWB.Sheets(1)
        .Cells(1).PasteSpecial Paste:=8
        .Cells(1).PasteSpecial xlPasteValues, , False, False
        .Cells(1).PasteSpecial xlPasteFormats, , False, False
        .Cells(1).Select
        Application.CutCopyMode = False
        On Error Resume Next
        .DrawingObjects.Visible = True
        .DrawingObjects.Delete
        On Error GoTo 0
    End With

    'Publish the sheet to a htm file
    With TempWB.PublishObjects.Add( _
         SourceType:=xlSourceRange, _
         Filename:=TempFile, _
         Sheet:=TempWB.Sheets(1).Name, _
         Source:=TempWB.Sheets(1).UsedRange.Address, _
         HtmlType:=xlHtmlStatic)
        .Publish (True)
    End With

    'Read all data from the htm file into RangetoHTML
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set ts = fso.GetFile(TempFile).OpenAsTextStream(1, -2)
    RangetoHTML = ts.readall
    ts.Close
    RangetoHTML = Replace(RangetoHTML, "align=center x:publishsource=", _
                          "align=left x:publishsource=")

    'Close TempWB
    TempWB.Close savechanges:=False

    'Delete the htm file we used in this function
    Kill TempFile

    Set ts = Nothing
    Set fso = Nothing
    Set TempWB = Nothing
End Function
 
Üst