Option Explicit
Sub MailSenden()
Application.ScreenUpdating = False
On Error Resume Next
Dim empfaenger As String
Dim i As Integer
Dim aws As String
Dim olapp As Object
empfaenger = "dein.empfaenger@xxx.de"
ActiveWorkbook.Sheets("Export").Copy
ActiveWorkbook.SaveAs ActiveSheet.Name
aws = ActiveWorkbook.FullName
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = empfaenger
.Subject = "Dein Text " & Date
.HtmlBody = "Dein Anschreiben im Mail-Body"
.attachments.Add aws
.Display
'SendKeys "%s", True 'Mail sofort senden
ActiveWorkbook.Close
Set olapp = Nothing
End With
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub MailSenden()
Application.ScreenUpdating = False
On Error Resume Next
Dim empfaenger As String
Dim i As Integer
Dim aws As String
Dim awsSheet As String
Dim olapp As Object
awsSheet = InputBox("Unter welchem Namen soll die Datei gespeichert werden?")
ActiveWorkbook.SaveAs Filename:="C:\Sony\" & neuName & ".xls"
empfaenger = "dein.empfaenger@xxx.de"
ActiveWorkbook.Sheets(awsSheet).Copy
ActiveWorkbook.SaveAs Filename:="C:\Sony\" & awsSheet & ".xls"
aws = ActiveWorkbook.FullName
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = empfaenger
.Subject = "Dein Text " & Date
.HtmlBody = "Dein Anschreiben im Mail-Body"
.attachments.Add aws
.Display
'SendKeys "%s", True 'Mail sofort senden
ActiveWorkbook.Close
Set olapp = Nothing
End With
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub MailSenden()
Application.ScreenUpdating = False
Dim empfaenger As String
Dim neuName As String
Dim expSheet As String
Dim olapp As Object
'um welches Tabellenbaltt geht es
expSheet = InputBox("Welches Blatt soll versandt und gespeichert werden??")
ActiveWorkbook.Sheets(expSheet).Copy
'unter welchem Dateinamen soll die neue Arbeitsmappe gespeicgert werden
neuName = InputBox("Unter welchem Namen soll die Datei gespeichert werden?")
ActiveWorkbook.SaveAs fileNAme:="C:\Sony\" & neuName & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
'wie lautet die Zieladresse (Mail)
empfaenger = "dein.empfaenger@xxx.de"
'Outlook starten und Mail mit Anhang erstellen
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = empfaenger
.Subject = "Dein Text " & Date
.HtmlBody = "Dein Anschreiben im Mail-Body"
.attachments.Add ActiveWorkbook.FullName
.Display
'SendKeys "%s", True 'Mail sofort senden
Set olapp = Nothing
End With
Set olapp = Nothing
ActiveWorkbook.Close
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub
Option Explicit
Sub MailSenden()
Application.ScreenUpdating = False
Dim empfaenger As String
Dim neuName As String
Dim expSheet As String
Dim olapp As Object
'um welches Tabellenbaltt geht es
'expSheet = InputBox("Welches Blatt soll versandt und gespeichert werden??")
'ActiveWorkbook.Sheets(expSheet).Copy
ActiveWorkbook.Sheets("Export").Copy
'unter welchem Dateinamen soll die neue Arbeitsmappe gespeicgert werden
neuName = InputBox("Unter welchem Namen soll die Datei gespeichert werden?")
ActiveWorkbook.SaveAs fileNAme:="C:\Sony\" & neuName & ".xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, CreateBackup:=False
'ActiveWorkbook.SaveAs fileNAme:="G:\Mein Excel\Herbers Excel-Forum\Max_02052024\" & _
neuName & ".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
'wie lautet die Zieladresse (Mail)
empfaenger = "dein.empfaenger@xxx.de"
'Outlook starten und Mail mit Anhang erstellen
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = empfaenger
.Subject = "Dein Text " & Date
.HtmlBody = "Dein Anschreiben im Mail-Body"
.attachments.Add ActiveWorkbook.FullName
.Display
'SendKeys "%s", True 'Mail sofort senden
Set olapp = Nothing
End With
Set olapp = Nothing
ActiveWorkbook.Close
Sheets(1).Activate
Application.ScreenUpdating = True
End Sub