Mail Anhang makro o. VBA-Codes
10.09.2007 08:10:07
marcus
ich benutze momentan folgendes Emailmakro.
Ich möchte aber gerne das bevor der Anhang verschickt wird, alle VBA-Codes deaktiviert werden. Ist das möglich?
Hier der Code:
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = "test"
.CC = ""
.BCC = ""
.Subject = "test "
.Body = "Hallo Zusammen," & vbCrLf & vbCrLf _
& "bitte folgende Artikel schnellstmöglich mitbestellen." & vbNewLine _
& vbCrLf & vbCrLf _
& "test"
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub