ich habe in meinem Tabellenblatt einen Button, mit dem ich das Blatt per Mail in die firma schicke. Leider sind im Tabellenblatt viele Formeln und mehrere Button.
Wie kann ich das aktive Tabellenblatt nur mit den Werten kopieren. Ich habe auch schon mal probiert, aber mein Code funktioniert nicht. Hat wer einen Tipp für mich?
Henri
Function Mail()
Dim oOL As Object, oOLMsg As Object, oOLRecip As Object, oOAttach As Object
Dim sRec As String, s
Sub As String, sBody As String, sMonth As String, sFile As String, sPath As String
Dim bln, box
Application.ScreenUpdating = False
Application.DisplayStatusBar = True
bln = Application.DisplayStatusBar
Set oOL = CreateObject("Outlook.Application")
sPath = "C:\"
sRec = Sheets("Grundeinstellungen").Cells(16, 1)
s
Sub = Sheets("Grundeinstellungen").Cells(17, 1) _
& " Monat " & Format(ActiveSheet.Cells(2, 1), "MMMM")
sBody = Sheets("Grundeinstellungen").Cells(18, 1)
sMonth = Format(ActiveSheet.Cells(2, 1), "MMMM")
ActiveSheet.Copy
Cells.Copy
Cells.Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
sFile = sPath & ActiveWorkbook.FullName & ".xls"
ActiveWorkbook.SaveAs sFile
Application.StatusBar = "Sende Monat " & sMonth & " an " & sRec & "..."
Set oOLMsg = oOL.CreateItem(0)
With oOLMsg
Set oOLRecip = .Recipients.Add(sRec)
.Subject = sSub
.Body = sBody
.Attachments.Add sFile
'.Send
.Display
End With
oOLRecip.Resolve
Set oOL = Nothing
ActiveWorkbook.Close savechanges:=False
Application.StatusBar = False
Application.DisplayStatusBar = bln
Kill sFile
box = MsgBox("Mail erfolgreich an " & sRec & " verschickt", vbInformation)
End Function