Hi Beri,
Hier ist der Code und bei .Body muss jetzt der Inhalt der
Zwischenablage rein.
Er sagt aber „Clipboard“ kennt er nicht.
es heisst getfromclipboard bzw putinclipboard.
Übrigens: Excel 2003
Der obere Code stammt von Hans Herber, ich habe nur Winzigkeiten angepasst. Ich habe .Display auf XL2000 getestet.
.Send mußt du testen
Den zweiten Code (Autor mir unbekannt) konnte ich nicht testen da XL2000 kein Mailenvelope usw. kennt.
Kannst ja bitte mal Feedback geben ob der zweite Code in XL2003 klappt.
Option Explicit
'
Private Sub SendEMail()
Dim oOL As Object
Dim oOLMsg As Object
Dim oOLRecip As Object
Dim oOLAttach As Object
Dim iRow As Integer, iCol As Integer
Dim sTxt As String
iRow = 1
iCol = 1
With Worksheets("Tabelle1")
Do Until iRow = 32
Do Until iCol = 7
sTxt = sTxt & .Cells(iRow, iCol) & Chr(9)
iCol = iCol + 1
Loop
sTxt = WorksheetFunction.Trim(sTxt) & vbCrLf
iCol = 1
iRow = iRow + 1
Loop
End With
Set oOL = CreateObject("Outlook.Application")
Set oOLMsg = oOL.CreateItem(0)
With oOLMsg
Set oOLRecip = .Recipients.Add("[email protected]")
.Subject = Format(Date, "dd.mm.yy") & " - " & Format(Time, "hh:mm:ss")
.cc = "[email protected]"
.bcc = "[email protected]"
.Body = sTxt
.Importance = 1
For Each oOLRecip In .Recipients
oOLRecip.Resolve
Next
.display
'.Send
End With
Set oOL = Nothing
End Sub
'
Sub Send\_OriginalRange\_from\_Excel()
'Getestet unter Office XP
'Ohne Select geht es nicht :smile:)
Range("A1:C9").Select
'Das anzeigen der Envelope Commandbar ist unabdingbar
ActiveWorkbook.EnvelopeVisible = True
'Nun werden die Adressen vergeben
With ActiveSheet.MailEnvelope
.Introduction = "Das ist der Einleitungstext." & vbCrLf & "mit einer zweiten Zeile"
.Item.To = "[email protected]"
.Item.Subject = "Die aktuellen Daten"
.Item.display
End With
End Sub
Gruß
Reinhard