Hi all
,
have a small workbook created as a working time card which i want to send by e-mail.
So far so good .... but would like to send it only the selected worksheet and not the whole workbook, and if possible only the print area without formulas, shortcuts and macros.
With this code I get only the whole workbook in the mail
Can someone help me there with the vba code?
Ps. Administrator, I am new and inexperienced, as well as English is not my native language, in case I am doing something wrong please inform me.Thx.
Thanks in Advance.
Nikko
,
have a small workbook created as a working time card which i want to send by e-mail.
So far so good .... but would like to send it only the selected worksheet and not the whole workbook, and if possible only the print area without formulas, shortcuts and macros.
With this code I get only the whole workbook in the mail
Can someone help me there with the vba code?
VBA Code:
------------------------------------------------------
Sub Excel_Workbook_via_Outlook_Senden()
Me.Unprotect ("1234")
Dim Nachricht As Object, OutApp As Object
Dim GruppenName, KasseMonat As String
Set OutApp = CreateObject("Outlook.Application")
Dim AWS As String
AWS = ThisWorkbook.FullName
ActiveSheet.UsedRange.Copy
Cells(1).PasteSpecial xlPasteValues
GruppenName = ThisWorkbook.Sheets("Januar").Range("I3")
KasseMonat = Month(CDate(ThisWorkbook.Sheets("Januar").Range("B1"))) & "/" & Year(CDate(ThisWorkbook.Sheets("Januar").Range("B1")))
Set Nachricht = OutApp.CreateItem(0)
With Nachricht
.To = "Abrechnung@mail.de"
.Subject = "Time Card - Kollege: " & GruppenName & " - Monat: " & KasseMonat & " - " & Date & Time
.Attachments.Add AWS
.Body = "Push Button and E-Mail send.." & vbCrLf & "Thx."
.Display
End With
Set OutApp = Nothing
Set Nachricht = Nothing
Me.Protect ("1234")
End Sub
------------------------------------------------------
Ps. Administrator, I am new and inexperienced, as well as English is not my native language, in case I am doing something wrong please inform me.Thx.
Thanks in Advance.
Nikko