Aschrum
09-04-2013, 06:18 AM
Hi,
I want to send a mail including content from an excel file.
Therefor the first step has to be sending a mail through Outlook 2007 only.
So far my code is the following and doesn't work yet.
Public Function BegleitungenKWsenden()
Dim app As Application 'Wrong or not necessary?
Dim itm As CreateItem 'Wrong or not necessary?
Set app = CreateObject("Application")
Set itm = Application.CreateItem(0) 'Shows a failure
On Error Resume Next
AppActivate ("Outlook")
Err.Clear
With itm
.To = ""
.Subject = ""
.Body = ""
.GetInspector
.Display
.Send
End With
On Error GoTo 0
Set app = Nothing
Set itm = Nothing
End Function
I've created it as a module. Should it maybe be a class module?
André
I want to send a mail including content from an excel file.
Therefor the first step has to be sending a mail through Outlook 2007 only.
So far my code is the following and doesn't work yet.
Public Function BegleitungenKWsenden()
Dim app As Application 'Wrong or not necessary?
Dim itm As CreateItem 'Wrong or not necessary?
Set app = CreateObject("Application")
Set itm = Application.CreateItem(0) 'Shows a failure
On Error Resume Next
AppActivate ("Outlook")
Err.Clear
With itm
.To = ""
.Subject = ""
.Body = ""
.GetInspector
.Display
.Send
End With
On Error GoTo 0
Set app = Nothing
Set itm = Nothing
End Function
I've created it as a module. Should it maybe be a class module?
André