Arkadaşlar exceldeki aşağıdaki makromla önceki versiyon outlookta gönderim yapmak sorun olmazken 2010 na yapılan geçişten sonra mümkün olmamaktadır.
Bana makro içerisinden neresinin değiştirilmesi gerektiği yönünde yardımcı olabilirseniz gerçekten çok sevinirim.
Sub sendemail()
Dim OutlookApp As Object, OutlookMsg As Object
Dim FSO As Object
Dim BodyText1 As Object, BodyText2 As Object
Dim MyRange As Range
Dim TempFile1 As String, TempFile2 As String
Dim NoF As Long
NoF = Range("A65536").Cells.End(xlUp).Row
If NoF > 1 Then
Range("A" & NoF + 2) = Range("CR1").Text
Range("A" & NoF + 2 & ":R" & NoF + 15).Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
Selection.Font.BOLD = False
End With
With Selection.Font
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End If
TempFile1 = "E:\TempHTML1.htm"
TempFile2 = "E:\TempHTML2.htm"
Set FSO = CreateObject("Scripting.FilesystemObject")
On Error Resume Next
Set MyRange = ActiveSheet.Range("A1:R" & NoF + 15)
If MyRange Is Nothing Then Exit Sub
ActiveWorkbook.PublishObjects.Add _
(4, TempFile1, MyRange.Parent.Name, MyRange.Address, 0, "", "").Publish True
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMsg = OutlookApp.CreateItem(0)
Set BodyText1 = FSO.OpenTextFile(TempFile1, 1)
Set BodyText2 = FSO.OpenTextFile(TempFile2, 1)
With OutlookMsg
.HTMLBody = BodyText1.ReadAll
.Subject = Range("A2").Text & " " & Range("CQ1").Text
.To = Range("CM1")
.CC = Range("CP1") + ";" + Range("CN1") + ";" + Range("CO1")
.Display
End With
Kill TempFile1
Kill TempFile2
Set BodyText2 = Nothing
Set BodyText1 = Nothing
Set OutlookMsg = Nothing
Set OutlookApp = Nothing
Set MyRange = Nothing
Set FSO = Nothing
End Sub
Bana makro içerisinden neresinin değiştirilmesi gerektiği yönünde yardımcı olabilirseniz gerçekten çok sevinirim.
Sub sendemail()
Dim OutlookApp As Object, OutlookMsg As Object
Dim FSO As Object
Dim BodyText1 As Object, BodyText2 As Object
Dim MyRange As Range
Dim TempFile1 As String, TempFile2 As String
Dim NoF As Long
NoF = Range("A65536").Cells.End(xlUp).Row
If NoF > 1 Then
Range("A" & NoF + 2) = Range("CR1").Text
Range("A" & NoF + 2 & ":R" & NoF + 15).Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlTop
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
Selection.Font.BOLD = False
End With
With Selection.Font
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End If
TempFile1 = "E:\TempHTML1.htm"
TempFile2 = "E:\TempHTML2.htm"
Set FSO = CreateObject("Scripting.FilesystemObject")
On Error Resume Next
Set MyRange = ActiveSheet.Range("A1:R" & NoF + 15)
If MyRange Is Nothing Then Exit Sub
ActiveWorkbook.PublishObjects.Add _
(4, TempFile1, MyRange.Parent.Name, MyRange.Address, 0, "", "").Publish True
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMsg = OutlookApp.CreateItem(0)
Set BodyText1 = FSO.OpenTextFile(TempFile1, 1)
Set BodyText2 = FSO.OpenTextFile(TempFile2, 1)
With OutlookMsg
.HTMLBody = BodyText1.ReadAll
.Subject = Range("A2").Text & " " & Range("CQ1").Text
.To = Range("CM1")
.CC = Range("CP1") + ";" + Range("CN1") + ";" + Range("CO1")
.Display
End With
Kill TempFile1
Kill TempFile2
Set BodyText2 = Nothing
Set BodyText1 = Nothing
Set OutlookMsg = Nothing
Set OutlookApp = Nothing
Set MyRange = Nothing
Set FSO = Nothing
End Sub
