Hi all
,
have a small workbook created as a working time card which you can send by e-mail.
So far so good .... but would like to send it only then 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?
Thanks in Advance.
Nikko
,
have a small workbook created as a working time card which you can send by e-mail.
So far so good .... but would like to send it only then 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 = "Abrechnung - Kollege: " & GruppenName & " - Monat: " & KasseMonat & " - " & Date & Time
.Attachments.Add AWS
.Body = "Bitte Drücke auf Senden und die E-Mail wird automatisch gesendet." & vbCrLf & "Vielen Dank."
.Display
End With
Set OutApp = Nothing
Set Nachricht = Nothing
MsgBox "Dont Forget!!!" & vbNewLine & "Print Sheet", vbInformation, "Be Friend"
Me.Protect ("1234")
End Sub
------------------------------------------------------
Thanks in Advance.
Nikko