• DİKKAT

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

autofilter ile filtre edilen sayfayı mail ile atmak

Katılım
1 Mart 2007
Mesajlar
72
Excel Vers. ve Dili
2003 ingilizce
Arkadaşlar, şirkette fatura ve raporlama için Excel ve access kullanıyorz. her fatura kesildiginde satış detaylarını Bir macro ile bir mdb dosyasına raporlama adı altında bir tablo ya yazdırıyoruz. sonrada bir excel dosyası ile burdan verileri açlırken indiriyoruz. sorun suki 1500 sütünluk veriyi autofilter ile müşteri ve ürün bazında seçebliyoruz. ben im istediğim ise:

Bir kaleme ait satış raporunu (bir müşterinin tüm satışları, bir ürününü tüm satışları vs...) müşteriye mail atabileceğim bir macro istiyorum ancak burda sorun su:

Sitede verilen outlook tan mail atma kodları işime yaramıyor çünkü o kodlar tüm sayfayı gönderiyor. halbuki benim sayfada başka müşterilerin de kayıtları oluyor ve fiyat bilgiside var. benim istediğim
Alanceç macrosuna eklenecek bir kod; bu kod
-Bana bir outlook mail penceresi acsın, dosyada filtre edilen kısımları alsın sadece ve bunu attachment olarak hazırlasın, ve ben orda gonderecegim kişiyi girebileyim adres kısmına. Dosya ektedir. yardımcı olabilecek arkadas varsa sevinirim.
 
Kod:
Sub Makro1()
    Cells.Select
    Selection.Copy
    Sheets.Add
    Cells.Select
    ActiveSheet.Paste
End Sub

yukarıdaki kodlar Autofilter ile elde edilen sayfa görüntüsünü yeni sayfa olarak kopyalar

http://www.excel.web.tr/showthread.php?t=43902

sn halukun aktifsayfayı elmek et kodlarında göndereceğiniz elmek adresini yazınca olay biter.

bu basitçe bir çözümdü.
 
Kod:
Sub Makro1()
    Cells.Select
    Selection.Copy
    Sheets.Add
    Cells.Select
    ActiveSheet.Paste
End Sub

yukarıdaki kodlar Autofilter ile elde edilen sayfa görüntüsünü yeni sayfa olarak kopyalar

http://www.excel.web.tr/showthread.php?t=43902

sn halukun aktifsayfayı elmek et kodlarında göndereceğiniz elmek adresini yazınca olay biter.

bu basitçe bir çözümdü.

İyi günler. bahsettiğiniz kod sanırım aşagıdaki kod. ancak bunun tam olarak neresine eklemem gerekiyor sizin gonderdiginiz kısmı? Birde bu kodu ben denedim. ancak bu kod direk e-mail gonderiyor kodda belirtilen e-mail adresine. her seferinde koda girip degistirmek gerekiyor ozaman e-mail adresini. Yada excel de bir cell de tutucam e-mail adresini ama genelde e-mail ları da ezbere bilmiyorum, outlooku acıp bakmam gerekiyor. bu sebeble bir outlook new mail penceresi acılsın istiyorum ki orada adres cubugunda kayıtlı adreslerime kolayca ulsabileyim

Kod:
[vb:1:a87fbdb470]'************************************************* *****
'* Sadece Aktif sayfayı MS Outlook ile yollamak için *
'* yapılmış bir çalışmadır *
'* Micosoft Outlook X.0 referansı eklenmelidir ! *
'* Burası Excel vadisi ... *
'* Raider ® *
'* �ubat 2005 *
'************************************************* *****

Sub SendShByEmail()
Dim OutApp As Outlook.Application
Dim NewMail As Outlook.MailItem
Dim ShName As String, WbName As String
Dim i As Integer
Dim ModX As Object, VBComp As Object

ShName = ActiveSheet.Name
WbName = "C:\" & ShName & ".xls"

ThisWorkbook.SaveCopyAs WbName

Application.DisplayAlerts = False
Workbooks.Open WbName
For i = Sheets.Count To 1 Step -1
If ActiveWorkbook.Sheets(i).Name <> ShName Then Sheets(i).Delete
Next

On Error Resume Next
For Each ModX In ActiveWorkbook.VBProject.VBComponents
Set VBComp = ActiveWorkbook.VBProject.VBComponents(ModX.Name)
ActiveWorkbook.VBProject.VBComponents.Remove VBComp
Next
On Error GoTo 0
Application.DisplayAlerts = True

ActiveWorkbook.Close SaveChanges:=True

Set OutApp = New Outlook.Application
Set NewMail = CreateItem(olMailItem)
With NewMail
.To = "falan@filan.com"
.Subject = "Deneme"
.Body = "Bu e-mail deneme amacıyla gönderilmiştir."
.Attachments.Add WbName
.Save
.Send
End With
Set NewMail = Nothing
Set OutApp = Nothing
Set VBComp = Nothing
Kill WbName
End Sub
[/vb:1:a87fbdb470]
 
Sub SendShByEmail()
'buraya benim g&#246;nderdiklerimi ekleyip deneyiniz
Dim OutApp As Outlook.Application
...................

elmek adreisnide textboxdan ald&#305;rabilirsiniz, ama butonla elmek veritabn&#305;ndan se&#231;im nas&#305;l olur &#351;imdilik fikrim yok
 
sn hakan439 bu bilgi i&#351;inize yarad&#305;m&#305;?
 
say&#305;n arkada&#351;lar.
&#231;ok g&#252;zel bilgiler g&#246;nderiyorsunuz,
ama g&#246;nderilen bilgiler beni ve benimgibileri a&#351;&#305;yor.
g&#246;nderilen bilgileri (i&#351;i bilen, uzman arkada&#351;lar) DERLEY&#304;P g&#246;nderirlerse bizde faydalanma imkan&#305; buluruz.
yoksa sadece bakmakla yetiniyoruz.
herkese kolay gelsin.
 
sn hakan439 bu bilgi işinize yaradımı?

maalesef tam olarak değil. gönderdiğiniz kodun son satırı (activesheet.paste) hata veriyor. gecerli kopyalama metodu diil gibi bir hata. ben soyle bir kod buldum onu değiştirmeye çalışıyorum 2 gündür. bu tam olarak istediğim şeyi yapıyor ancak filtre edilen kısımları değil de tüm sayfayı alıyor. size de bir göndereyim bakın isterseniz:

Kod:
Option Explicit

Sub Mail_ActiveSheet()
'Working in 2000-2007
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set Sourcewb = ActiveWorkbook

    'Copy the sheet to a new workbook
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook

    'Determine the Excel version and file extension/format
    With Destwb
        If Val(Application.Version) < 12 Then
            'You use Excel 97-2003
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            'You use Excel 2007
            'We exit the sub when your answer is NO in the security dialog that you only
            'see  when you copy a sheet from a xlsm file with macro's disabled.
            If Sourcewb.Name = .Name Then
                With Application
                    .ScreenUpdating = True
                    .EnableEvents = True
                End With
                MsgBox "Your answer is NO in the security dialog"
                Exit Sub
            Else
                Select Case Sourcewb.FileFormat
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                Case 52:
                    If .HasVBProject Then
                        FileExtStr = ".xlsm": FileFormatNum = 52
                    Else
                        FileExtStr = ".xlsx": FileFormatNum = 51
                    End If
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
                End Select
            End If
        End If
    End With

    '    'Change all cells in the worksheet to values if you want
    '    With Destwb.Sheets(1).UsedRange
    '        .Cells.Copy
    '        .Cells.PasteSpecial xlPasteValues
    '        .Cells(1).Select
    '    End With
    '    Application.CutCopyMode = False

    'Save the new workbook/Mail it/Delete it
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = "ron@debruin.nl"
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Display   'or use .Send
        End With
        On Error GoTo 0
        .Close SaveChanges:=False
    End With

    'Delete the file you have send
    Kill TempFilePath & TempFileName & FileExtStr

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
End Sub
 
sn hakan439 e&#287;er excel2007 sayfas&#305; g&#246;ndermekten bahsediyorsan&#305;z hi&#231; bir fikrim yok

siz g&#246;nderece&#287;ini&#351;z sayfan&#305;n bilgileri &#246;nemsiz hala getirerek bir &#246;rnek g&#246;nderin bakal&#305;m

siz sayfay&#305; direk g&#246;ndermek yerine outlok ekran&#305;na otomatik olarak eklenti haline gelmesinden bahsediyorsunuz galiba.....

kodlar&#305; inceleyip bir bakay&#305;m belki olur
 
dosyalar ekte. &#351;u anda sadece cal&#305;&#351;&#305;lan worksheet i gonderiyor. ancak filtre edilen k&#305;s&#305;mlar&#305; de&#287;ik sayfan&#305;n tamam&#305;n&#305; gonderiyor. bunu bir m&#252;&#351;teriye gonderdi&#287;im zaman m&#252;&#351;teri t&#252;m firmalar&#305;n bilgilerini gorebilir. bu y&#252;zden sadece filre edilenk&#305;sm&#305; gondermesini istiyorum. mail atma ile ilgili bir kac kod daha buldum. onlar&#305;da da gonderiyorum size. rar dosyas&#305;n&#305;n i&#231;inde &#231;e&#351;itli mail atma kodlar&#305; mevcut.
 
Kod:
Option Explicit

Sub Mail_ActiveSheet()
'Filtre edilen alan&#305; yeni sayfaya al&#305;r

    Cells.Select:    Selection.Copy
    Sheets.Add:      Cells.Select
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   's&#252;tun geni&#351;likleirni kopyalar
    Cells.Select
    ActiveSheet.Paste   'her&#351;eyi kopyalar
    'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False  'sadece de&#287;erleri kopyalar
    'Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   'bi&#231;imleri kopyalar


'Working in 2000-2007
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set Sourcewb = ActiveWorkbook

    'Copy the sheet to a new workbook
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook

    'Determine the Excel version and file extension/format
    With Destwb
        If Val(Application.Version) < 12 Then
            'You use Excel 97-2003
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            'You use Excel 2007
            'We exit the sub when your answer is NO in the security dialog that you only
            'see  when you copy a sheet from a xlsm file with macro's disabled.
            If Sourcewb.Name = .Name Then
                With Application
                    .ScreenUpdating = True
                    .EnableEvents = True
                End With
                MsgBox "Your answer is NO in the security dialog"
                Exit Sub
            Else
                Select Case Sourcewb.FileFormat
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                Case 52:
                    If .HasVBProject Then
                        FileExtStr = ".xlsm": FileFormatNum = 52
                    Else
                        FileExtStr = ".xlsx": FileFormatNum = 51
                    End If
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
                End Select
            End If
        End If
    End With

    '    'Change all cells in the worksheet to values if you want
    '    With Destwb.Sheets(1).UsedRange
    '        .Cells.Copy
    '        .Cells.PasteSpecial xlPasteValues
    '        .Cells(1).Select
    '    End With
    '    Application.CutCopyMode = False

    'Save the new workbook/Mail it/Delete it
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = "ron@debruin.nl"
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Display   'or use .Send
        End With
        On Error GoTo 0
        .Close SaveChanges:=False
    End With

    'Delete the file you have send
    Kill TempFilePath & TempFileName & FileExtStr
    Application.ScreenUpdating = False
       Sheets(1).Delete
    'Application.ScreenUpdating = False
 
    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
End Sub
deneyiniz
 
Kod:
    ActiveSheet.Paste   'her&#351;eyi kopyalar

bu sat&#305;rda hata verdi. Ayr&#305;ca yeni bir sheet a&#231;&#305;yor. ancak daha &#246;nce de soyledim, bu komut ta bir sorun variyor benim excel. Ayr&#305;ca mail att&#305;ktan sonra bu sayfan&#305;nda silinmesini istiyorum cunku arka arkaya 2,3 m&#252;&#351;teriye bunu g&#246;nderdi&#287;imde her seferinde sayfa ekleniyor programa.
BU arada ben kodu biraz de&#287;i&#351;tirdim. &#351;imdi sadece tabloyu al&#305;yor kalanlar&#305; alm&#305;yor.

Kod:
    Sub mail()
Dim say As Integer
say = WorksheetFunction.CountA(Range("H1:H65000"))
Range("A1:k1").Select '(Bu b&#246;l&#252;m sayfadaki ba&#351;l&#305;k k&#305;sm&#305;)
say = say + 10
ActiveSheet.PageSetup.PrintArea = "$A$1:$k$" & say
Range("B2").Select
'ActiveWindow.SelectedSheets.PrintPreview
'----------------------------------------------------------------------

'esas kod burdan ba&#351;l&#305;yor. forumda g&#246;nderdim zaten size de.
'&#220;st taraf sadece print area y&#305; son girilen sat&#305;r&#305; kapsayacak
'&#351;ekilde ayarl&#305;yor.

'----------------------------------------------------------------------
'----------------------------------------------------------------------
'buray&#305; biraz de&#287;i&#351;tirdim. art&#305;k sadece taloyu al&#305;yor t&#252;m sayfa yerine
'----------------------------------------------------------------------
'----------------------------------------------------------------------

'Filtre edilen alan&#305; yeni sayfaya al&#305;r;


    Range("$A$1:$k$" & say).Select:    Selection.Copy
    Sheets.Add:      Cells.Select
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   's&#252;tun geni&#351;likleirni kopyalar
    Range("$A$1:$k$" & say).Select
    
    
    ActiveSheet.Paste   'her&#351;eyi kopyalar
    'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False  'sadece de&#287;erleri kopyalar
    'Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   'bi&#231;imleri kopyalar


'Working in 2000-2007
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set Sourcewb = ActiveWorkbook

    'Copy the sheet to a new workbook
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook

    'Determine the Excel version and file extension/format
    With Destwb
        If Val(Application.Version) < 12 Then
            'You use Excel 97-2003
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            'You use Excel 2007
            'We exit the sub when your answer is NO in the security dialog that you only
            'see  when you copy a sheet from a xlsm file with macro's disabled.
            If Sourcewb.Name = .Name Then
                With Application
                    .ScreenUpdating = True
                    .EnableEvents = True
                End With
                MsgBox "Your answer is NO in the security dialog"
                Exit Sub
            Else
                Select Case Sourcewb.FileFormat
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                Case 52:
                    If .HasVBProject Then
                        FileExtStr = ".xlsm": FileFormatNum = 52
                    Else
                        FileExtStr = ".xlsx": FileFormatNum = 51
                    End If
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
                End Select
            End If
        End If
    End With

    '    'Change all cells in the worksheet to values if you want
    '    With Destwb.Sheets(1).UsedRange
    '        .Cells.Copy
    '        .Cells.PasteSpecial xlPasteValues
    '        .Cells(1).Select
    '    End With
    '    Application.CutCopyMode = False

    'Save the new workbook/Mail it/Delete it
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = "ron@debruin.nl"
            .CC = ""
            .BCC = ""
            .Subject = "This is the Subject line"
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Display   'or use .Send
        End With
        On Error GoTo 0
        .Close SaveChanges:=False
    End With

    'Delete the file you have send
    Kill TempFilePath & TempFileName & FileExtStr
    Application.ScreenUpdating = False
       Sheets(1).Delete
    'Application.ScreenUpdating = False
 
    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With

End Sub

 
Son düzenleme:
hocam birdr bunu deneyin

Kod:
Sub Mail_ActiveSheet()
Application.ScreenUpdating = False
's&#252;z&#252;len kriterlerin ba&#351;l&#305;klar&#305;n&#305; ve de&#287;erlerini bulur
Dim suz As Variant
ReDim suz(ActiveSheet.AutoFilter.Filters.Count)
sonfiltsut = ActiveSheet.AutoFilter.Filters.Count
For a = sonfiltsut To 1 Step -1
    If ActiveSheet.AutoFilter.Filters.Item(a).On Then
        c = c + 1
        stnno = ActiveSheet.AutoFilter.Range.Cells(a).Column
        strno = ActiveSheet.AutoFilter.Range.Cells(a).Row
        SuzBas = ActiveSheet.AutoFilter.Range.Cells(a).Value
        SuzKrt = Kriterler(Cells(strno + 1, stnno))
        suz(c) = SuzBas & ": " & SuzKrt
        snc = suz(c) & ", " & snc
    End If
Next

'Filtrelenmi&#351; ba&#351;l&#305;klar&#305; yeni sayfaya kopyalar
    Cells.Select:    Selection.Copy
    Sheets.Add:      Cells.Select
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   's&#252;tun geni&#351;likleirni kopyalar
    Cells.Select
    ActiveSheet.Paste   'her&#351;eyi kopyalar
    Application.CutCopyMode = False
    Cells(1, 1).Select
    'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False  'sadece de&#287;erleri kopyalar
    'Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   'bi&#231;imleri kopyalar
   'MsgBox snc



'olu&#351;turulan yeni sayfan&#305;n&#305;n kenarl&#305;k ve yazd&#305;rma alanlar&#305;n&#305; d&#252;zenler
sonsut = Cells(strno, 1).End(xlToRight).Column
sonsat = Cells(65536, 1).End(xlUp).Row
'MsgBox strno & " / " & stnno & " / " & sonsut & " / " & sonsat
'Exit Sub
    
   Range(Cells(strno - 5, 1), Cells(strno - 5, sonsut)).Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With
    With Selection.Font
        .Name = "Arial Tur"
        .Size = 12
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    Rows(strno - 5).RowHeight = 19.5
    Selection.Font.Bold = True
    Cells(strno - 5, 1).Value = snc & " Raporudur"
    ' ThisWorkbook.Sheets(1).Delete
'mevcut kenarl&#305;klar&#305; sil
    Cells.Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'yeni kenarl&#305;k &#231;iz
    'Range("A11:K55").Select
    Range(Cells(strno, 1), Cells(sonsat, sonsut)).Select

    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
'************************************************
'yazd&#305;rma alan&#305;n&#305; belirle

ActiveSheet.PageSetup.PrintArea = "$A$1:$K$" & sonsat
    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.984251968503937)
        .BottomMargin = Application.InchesToPoints(0.984251968503937)
        .HeaderMargin = Application.InchesToPoints(0.511811023622047)
        .FooterMargin = Application.InchesToPoints(0.511811023622047)
        .Orientation = xlLandscape
    End With
Cells(1, 1).Select
  
  
'buradan itibaren aktif sayfay&#305; otutlook 2003 e eklenti olarak ekler.
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set Sourcewb = ActiveWorkbook

    'Copy the sheet to a new workbook
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook

    'Determine the Excel version and file extension/format
    With Destwb
        If Val(Application.Version) < 12 Then
            'You use Excel 97-2003
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            'You use Excel 2007
            'We exit the sub when your answer is NO in the security dialog that you only
            'see  when you copy a sheet from a xlsm file with macro's disabled.
            If Sourcewb.Name = .Name Then
                With Application
                    .ScreenUpdating = True
                    .EnableEvents = True
                End With
                MsgBox "Your answer is NO in the security dialog"
                Exit Sub
            Else
                Select Case Sourcewb.FileFormat
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                Case 52:
                    If .HasVBProject Then
                        FileExtStr = ".xlsm": FileFormatNum = 52
                    Else
                        FileExtStr = ".xlsx": FileFormatNum = 51
                    End If
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
                End Select
            End If
        End If
    End With

    
   'Save the new workbook/Mail it/Delete it
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = snc & " Raporudur" '"This is the Subject line"
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Display   'or use .Send
        End With
        On Error GoTo 0
        .Close SaveChanges:=False
    End With

    'Delete the file you have send
    Kill TempFilePath & TempFileName & FileExtStr
    Application.DisplayAlerts = False   'ekrana mesaj vermeyi kapat
        Sheets(1).Delete
    Application.DisplayAlerts = True   'ekrana mesaj vermeyi a&#231;

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With
    
MsgBox "tamamland&#305;"
End Sub

s&#252;z&#252;len kriterleri konu ba&#351;l&#305;&#287;&#305; olarak eklemek i&#231;in gereklidir.
Kod:
Function Kriterler(BaslikAlti As Range) As String
Dim Filter As String
Filter = ""
On Error GoTo son
With BaslikAlti.Parent.AutoFilter
If Intersect(BaslikAlti, .Range) Is Nothing Then GoTo son
With .Filters(BaslikAlti.Column - .Range.Column + 1)
If Not .On Then GoTo son
Filter = Replace(.Criteria1, "=", """", 2)
Filter2 = Replace(.Criteria2, "=", """", 2)

Select Case .Operator
Case xlAnd
Filter = Filter & " ve " & Filter2
Case xlOr
Filter = Filter & " veya " & Filter2
End Select

End With
End With
son:
Kriterler = Filter
End Function
 
buda çalışmazsa nedenini bilemem hiç bir değişklik yapmadan gözleyin önce
sizin istediğiniz gibi
1) filtre sonucu elde edilen hücreleri yeni sayfaya alıyor.
2) yeni sayfada kenarlıkları ve yazdırma alanını tekrar yapılandırıyor.
3) sayfayı yataya çeviriyor
4) elde edilen sayfayı outloka eklenti olarak keliyor.

activesheet.paste neden hata verir bilmiyorum.

ayrı bir başlıkta activesheet.paste Hata sorunu diye konu açın isterseniz.
 
Son düzenleme:
a&#351;a&#287;&#305;daki kodlar ile veriler s&#252;z&#252;lm&#252;&#351;se s&#252;z&#252;len alan&#305;
s&#252;z&#252;lmemi&#351; ise sayfan&#305;n tamam&#305;n g&#246;nderir.

Kod:
Sub Mail_ActiveSheet()
Application.ScreenUpdating = False
's&#252;z&#252;len kriterlerin ba&#351;l&#305;klar&#305;n&#305; ve de&#287;erlerini bulur
If ActiveSheet.FilterMode = False Then GoTo TAMAMINIGONDER
Dim suz As Variant
ReDim suz(ActiveSheet.AutoFilter.Filters.Count)
sonfiltsut = ActiveSheet.AutoFilter.Filters.Count
For a = sonfiltsut To 1 Step -1
    If ActiveSheet.AutoFilter.Filters.Item(a).On Then
        c = c + 1
        stnno = ActiveSheet.AutoFilter.Range.Cells(a).Column
        strno = ActiveSheet.AutoFilter.Range.Cells(a).Row
        SuzBas = ActiveSheet.AutoFilter.Range.Cells(a).Value
        SuzKrt = Kriterler(Cells(strno + 1, stnno))
        suz(c) = SuzBas & ": " & SuzKrt
        snc = suz(c) & ", " & snc
    End If
Next

'Filtrelenmi&#351; ba&#351;l&#305;klar&#305; yeni sayfaya kopyalar
    Cells.Select:    Selection.Copy
    Sheets.Add:      Cells.Select
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   's&#252;tun geni&#351;likleirni kopyalar
    Cells.Select
    ActiveSheet.Paste   'her&#351;eyi kopyalar
    Application.CutCopyMode = False
    Cells(1, 1).Select
    'Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False  'sadece de&#287;erleri kopyalar
    'Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False   'bi&#231;imleri kopyalar
   'MsgBox snc
'olu&#351;turulan yeni sayfan&#305;n&#305;n kenarl&#305;k ve yazd&#305;rma alanlar&#305;n&#305; d&#252;zenler
sonsut = Cells(strno, 1).End(xlToRight).Column
sonsat = Cells(65536, 1).End(xlUp).Row
'MsgBox strno & " / " & stnno & " / " & sonsut & " / " & sonsat
'Exit Sub
    
   Range(Cells(strno - 5, 1), Cells(strno - 5, sonsut)).Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = True
    End With
    With Selection.Font
        .Name = "Arial Tur"
        .Size = 12
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    Rows(strno - 5).RowHeight = 19.5
    Selection.Font.Bold = True
    Cells(strno - 5, 1).Value = snc & " Raporudur"
    ' ThisWorkbook.Sheets(1).Delete
'mevcut kenarl&#305;klar&#305; sil
    Cells.Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    Selection.Borders(xlEdgeLeft).LineStyle = xlNone
    Selection.Borders(xlEdgeTop).LineStyle = xlNone
    Selection.Borders(xlEdgeBottom).LineStyle = xlNone
    Selection.Borders(xlEdgeRight).LineStyle = xlNone
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'yeni kenarl&#305;k &#231;iz
    'Range("A11:K55").Select
    Range(Cells(strno, 1), Cells(sonsat, sonsut)).Select

    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .Weight = xlMedium
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .Weight = xlThin
        .ColorIndex = xlAutomatic
    End With
'************************************************
'yazd&#305;rma alan&#305;n&#305; belirle

ActiveSheet.PageSetup.PrintArea = "$A$1:$K$" & sonsat
    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(0.393700787401575)
        .RightMargin = Application.InchesToPoints(0.393700787401575)
        .TopMargin = Application.InchesToPoints(0.984251968503937)
        .BottomMargin = Application.InchesToPoints(0.984251968503937)
        .HeaderMargin = Application.InchesToPoints(0.511811023622047)
        .FooterMargin = Application.InchesToPoints(0.511811023622047)
        .Orientation = xlLandscape
    End With
Cells(1, 1).Select
  
TAMAMINIGONDER:
'buradan itibaren aktif sayfay&#305; otutlook 2003 e eklenti olarak ekler.
    Dim FileExtStr As String
    Dim FileFormatNum As Long
    Dim Sourcewb As Workbook
    Dim Destwb As Workbook
    Dim TempFilePath As String
    Dim TempFileName As String
    Dim OutApp As Object
    Dim OutMail As Object

    With Application
        .ScreenUpdating = False
        .EnableEvents = False
    End With

    Set Sourcewb = ActiveWorkbook

    'Copy the sheet to a new workbook
    ActiveSheet.Copy
    Set Destwb = ActiveWorkbook

    'Determine the Excel version and file extension/format
    With Destwb
        If Val(Application.Version) < 12 Then
            'You use Excel 97-2003
            FileExtStr = ".xls": FileFormatNum = -4143
        Else
            'You use Excel 2007
            'We exit the sub when your answer is NO in the security dialog that you only
            'see  when you copy a sheet from a xlsm file with macro's disabled.
            If Sourcewb.Name = .Name Then
                With Application
                    .ScreenUpdating = True
                    .EnableEvents = True
                End With
                MsgBox "Your answer is NO in the security dialog"
                Exit Sub
            Else
                Select Case Sourcewb.FileFormat
                Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
                Case 52:
                    If .HasVBProject Then
                        FileExtStr = ".xlsm": FileFormatNum = 52
                    Else
                        FileExtStr = ".xlsx": FileFormatNum = 51
                    End If
                Case 56: FileExtStr = ".xls": FileFormatNum = 56
                Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
                End Select
            End If
        End If
    End With

    ek = snc
    If ek = "" Then ek = "T&#252;m dosya"
   'Save the new workbook/Mail it/Delete it
    TempFilePath = Environ$("temp") & "\"
    TempFileName = "Part of " & Sourcewb.Name & " " & Format(Now, "dd-mmm-yy h-mm-ss")

    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)

    With Destwb
        .SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
        On Error Resume Next
        With OutMail
            .To = ""
            .CC = ""
            .BCC = ""
            .Subject = ek & " Raporudur" '"This is the Subject line"
            .Body = "Hi there"
            .Attachments.Add Destwb.FullName
            'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            .Display   'or use .Send
        End With
        On Error GoTo 0
        .Close SaveChanges:=False
    End With

    'Delete the file you have send
    Kill TempFilePath & TempFileName & FileExtStr
    If snc <> "" Then
    Application.DisplayAlerts = False   'ekrana mesaj vermeyi kapat
        Sheets(1).Delete
    Application.DisplayAlerts = True   'ekrana mesaj vermeyi a&#231;
    End If
    Set OutMail = Nothing
    Set OutApp = Nothing

    Application.ScreenUpdating = True
        
MsgBox "tamamland&#305;"
End Sub
 
e&#287;er veriler s&#252;z&#252;lmemi&#351;se g&#246;ndermek istemiyorsan&#305;z
If ActiveSheet.FilterMode = False Then GoTo TAMAMINIGONDER
sat&#305;r&#305;n&#305;
If ActiveSheet.FilterMode = False Then MsgBox "veriler s&#252;z&#252;lmemi&#351;": Exit Sub
sat&#305;r&#305; ile de&#287;i&#351;tiriniz
 
bende "

Hotmail'le &#37;s olarak ba&#287;lant&#305; kurulamad&#305;.

Hotmail art&#305;k &#252;cretsiz e-posta hesaplar&#305; i&#231;in Outlook Express arac&#305;l&#305;&#287;&#305;yla e-posta eri&#351;imine izin vermiyor.

Hesap: 'MSN', Sunucu: 'http://oe.msn.msnmail.hotmail.com/cgi-bin/hmdata', &#304;leti&#351;im Kurallar&#305;: HTTPMail, Sunucu Yan&#305;t&#305;: 'Access to Hotmail via Outlook and Outlook Express now requires a subscription. Please sign up at http://join.msn.com/general/Email', Ba&#287;lant&#305; Noktas&#305;: 0, G&#252;venli(SSL): Hay&#305;r, Sunucu Hatas&#305;: 998, Hata numaras&#305;: 0x800CCCF6

"

bu mesaj &#231;&#305;k&#305;yor.

l&#252;tfen ya nas&#305;l bir yol izleyece&#287;imizi a&#351;ama a&#351;ama anlats&#305;n, yada en son halini bir &#246;rnek dosya yap&#305;p g&#246;ndersin.
 
bende "

Hotmail'le %s olarak bağlantı kurulamadı.

Hotmail artık ücretsiz e-posta hesapları için Outlook Express aracılığıyla e-posta erişimine izin vermiyor.

Hesap: 'MSN', Sunucu: 'http://oe.msn.msnmail.hotmail.com/cgi-bin/hmdata', İletişim Kuralları: HTTPMail, Sunucu Yanıtı: 'Access to Hotmail via Outlook and Outlook Express now requires a subscription. Please sign up at http://join.msn.com/general/Email', Bağlantı Noktası: 0, Güvenli(SSL): Hayır, Sunucu Hatası: 998, Hata numarası: 0x800CCCF6

"

bu mesaj çıkıyor.

lütfen ya nasıl bir yol izleyeceğimizi aşama aşama anlatsın, yada en son halini bir örnek dosya yapıp göndersin.


verdiğim kodlar outlok 2003 için için geçerlidir

Set OutApp = CreateObject("Outlook.Application")

gmail kullanın
http://mail.google.com/support/bin/answer.py?hl=tr&answer=77661
 
sn hakan 439 deneme &#351;ans&#305;n&#305;z oldumu acaba
 
Sn. hsayar,

12. mesajda yazdıgınız kodlar, 13. mesajınızda eklediğiniz dosyada var mı? eğer aynı kodlar sa, eklediğiniz dosyayı indirdim denedim ancak aynı satırda yine hata verdi. benim excel de mi bir sorun var anlayamadım. siz denediğinizde sorun var mıy dı
 
hay&#305;r bende yoktu......
 
Geri
Üst