L
Ludo
Hi,
I want to send a message using Outlook with an atachment.
I use following code adapted for my purpose:
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
' source base: http://www.rondebruin.nl/tips.htm
' adapted for my use
Dim OutApp As Object
Dim OutMail As Object
Const sMsg2 = "Send methode = Outlook"
' read data from ini file
szSection = "Expence"
szKey = "Mail Address1"
MailTo1 = GetIniKey(szFile, szSection, szKey)
szKey = "Mail Address2"
MailTo2 = GetIniKey(szFile, szSection, szKey)
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = MailTo1
If MailTo2 <> "0" Then
.CC = MailTo2
End If
.Subject = wbName
.Body = sMsg & vbCrLf & sMsg2
.Attachments.Add wbPathName
.Send '.Display '
End With
Debug.Print Send
On Error GoTo 0
OutApp.Session.Logoff
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What's the problem?
When i try it, and use my e-mail address to send to, i don't receive
the mail!
When i change the .Send into .Display , then it displays on screen ,
but what i don't find back in the toolbar is the Send button.
Outlook isn't my default mail client, i use always Outlook Express.
What's causing the problem, and how to solve it?
Regards,
Ludo
I want to send a message using Outlook with an atachment.
I use following code adapted for my purpose:
Sub Mail_workbook_Outlook_1()
'Working in 2000-2007
'This example send the last saved version of the Activeworkbook
' source base: http://www.rondebruin.nl/tips.htm
' adapted for my use
Dim OutApp As Object
Dim OutMail As Object
Const sMsg2 = "Send methode = Outlook"
' read data from ini file
szSection = "Expence"
szKey = "Mail Address1"
MailTo1 = GetIniKey(szFile, szSection, szKey)
szKey = "Mail Address2"
MailTo2 = GetIniKey(szFile, szSection, szKey)
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = MailTo1
If MailTo2 <> "0" Then
.CC = MailTo2
End If
.Subject = wbName
.Body = sMsg & vbCrLf & sMsg2
.Attachments.Add wbPathName
.Send '.Display '
End With
Debug.Print Send
On Error GoTo 0
OutApp.Session.Logoff
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
What's the problem?
When i try it, and use my e-mail address to send to, i don't receive
the mail!
When i change the .Send into .Display , then it displays on screen ,
but what i don't find back in the toolbar is the Send button.
Outlook isn't my default mail client, i use always Outlook Express.
What's causing the problem, and how to solve it?
Regards,
Ludo