Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send mail problem
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send mail problem
You are using code written for Outlook. Regardless of your default mail
program, do you have Outlook installed and account set up to do emails? Outlook must be functioning as a mail program in order to send mail. It does not have to be the default. With your code you should be able to send yourself an email from Outlook and receive it in OExpress (default), but both programs must be set up with email accounts. If this is not your situation and both mailers are functioning, then you may need Ron to help you out. Mike F "Ludo" wrote in message ups.com... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send mail problem
For the OP
Run Office Diagnostics. Office ButtonExcel Options...Resources If you have the same problem then is the example in the workbook from my site working for you ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Mike Fogleman" wrote in message m... You are using code written for Outlook. Regardless of your default mail program, do you have Outlook installed and account set up to do emails? Outlook must be functioning as a mail program in order to send mail. It does not have to be the default. With your code you should be able to send yourself an email from Outlook and receive it in OExpress (default), but both programs must be set up with email accounts. If this is not your situation and both mailers are functioning, then you may need Ron to help you out. Mike F "Ludo" wrote in message ups.com... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send mail problem
On 6 okt, 15:53, "Mike Fogleman" wrote:
You are using code written for Outlook. Regardless of your default mail program, do you have Outlook installed and account set up to do emails? Outlook must be functioning as a mail program in order to send mail. It does not have to be the default. With your code you should be able to send yourself an email from Outlook and receive it in OExpress (default), but both programs must be set up with email accounts. If this is not your situation and both mailers are functioning, then you may need Ron to help you out. Mike F"Ludo" wrote in message ups.com... 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- Tekst uit oorspronkelijk bericht niet weergeven - - Tekst uit oorspronkelijk bericht weergeven - Hi Mike, I guess that the issue you mention is causing the problem. I assume that, when installing Office, Outlook is installed by default, but i didn't setup an account for it, because i never use it. So probebly is the problem solved with your answer. Thanks anyway to get me in the right direction. Ludo |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Send mail problem
I haved used Rons code very successfully and I too also use Outlook Express
as my mail program. I had experience a similar problem to you with regard to not receiving a €śtest€ť email I sent to myself when testing Rons code! I found that this email was being treated as spam and moved to the spam folder so did not download via outlook express. Updating my mail settings via the web solved the problem. Hope this may be of some help. -- JB "Ludo" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Bypass: A program is trying to send mail using Item.Send prompt | Excel Discussion (Misc queries) | |||
A program is trying to send mail using Item.Send | Excel Programming | |||
Send e-mail | Excel Programming | |||
Send mail problem in Office 2003 | Excel Programming | |||
send mail with MAPI problem | Excel Programming |