![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I have this code to send email using Excel macro, it works fine abut the
message stays in outbox until i open outlook then it sends it. how i can send receive even if outlook closed? any help? thanks! Sub ComposeMail(strto As String, strSubject As String, strbody As String, strAttachment As String) Dim objOL As Outlook.Application Dim objX As Outlook.MailItem Set objOL = New Outlook.Application Set objX = objOL.CreateItem(olMailItem) With objX .To = strto .Subject = strSubject .Body = strbody If strAttachment "" Then .Attachments.Add strAttachment End If .BodyFormat = olFormatHTML .Display End With Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys "%s" End Sub |
Ads |
#2
|
|||
|
|||
![]()
This might not be the answer you're looking for, but why not just
leave Outlook open? --JP On Nov 10, 3:41*pm, "adma" u56099@uwe wrote: I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send receive even if outlook closed? any help? thanks! Sub ComposeMail(strto As String, strSubject As String, strbody As String, strAttachment As String) * * Dim objOL As Outlook.Application * * Dim objX As Outlook.MailItem * * Set objOL = New Outlook.Application * * Set objX = objOL.CreateItem(olMailItem) * * With objX * * * * .To = strto * * * * .Subject = strSubject * * * * .Body = strbody * * * * If strAttachment "" Then * * * * * * .Attachments.Add strAttachment * * * * End If * * * * .BodyFormat = olFormatHTML * * * * .Display * * End With * * Application.Wait (Now + TimeValue("0:00:02")) * * Application.SendKeys "%s" End Sub |
#3
|
|||
|
|||
![]()
Try putting a .send at the end of your With.
How are you early binding your objOL, I try that and am informed that excel doesn't know about the Outlook class. and have to dimension as an Object and use CreateObject. "adma" wrote: I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send receive even if outlook closed? any help? thanks! Sub ComposeMail(strto As String, strSubject As String, strbody As String, strAttachment As String) Dim objOL As Outlook.Application Dim objX As Outlook.MailItem Set objOL = New Outlook.Application Set objX = objOL.CreateItem(olMailItem) With objX .To = strto .Subject = strSubject .Body = strbody If strAttachment "" Then .Attachments.Add strAttachment End If .BodyFormat = olFormatHTML .Display End With Application.Wait (Now + TimeValue("0:00:02")) Application.SendKeys "%s" End Sub . |
#4
|
|||
|
|||
![]()
the same, the message stays at the outbox.
Thanks for the reply Old Man River wrote: Try putting a .send at the end of your With. How are you early binding your objOL, I try that and am informed that excel doesn't know about the Outlook class. and have to dimension as an Object and use CreateObject. I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send [quoted text clipped - 23 lines] . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200911/1 |
#5
|
|||
|
|||
![]()
Hi. In Outlook on the Tools Menu choose Options. Click the Mail Setup tab -
is "Send immeadiately when connected" selected? Might help. "adma via OfficeKB.com" wrote: the same, the message stays at the outbox. Thanks for the reply Old Man River wrote: Try putting a .send at the end of your With. How are you early binding your objOL, I try that and am informed that excel doesn't know about the Outlook class. and have to dimension as an Object and use CreateObject. I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send [quoted text clipped - 23 lines] . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200911/1 . |
#6
|
|||
|
|||
![]()
On Nov 10, 3:41*pm, "adma" u56099@uwe wrote:
I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send receive even if outlook closed? any help? thanks! Sub ComposeMail(strto As String, strSubject As String, strbody As String, strAttachment As String) * * Dim objOL As Outlook.Application * * Dim objX As Outlook.MailItem * * Set objOL = New Outlook.Application * * Set objX = objOL.CreateItem(olMailItem) * * With objX * * * * .To = strto * * * * .Subject = strSubject * * * * .Body = strbody * * * * If strAttachment "" Then * * * * * * .Attachments.Add strAttachment * * * * End If * * * * .BodyFormat = olFormatHTML * * * * .Display * * End With * * Application.Wait (Now + TimeValue("0:00:02")) * * Application.SendKeys "%s" End Sub I'm interested in doing this as well, if you find/get a resolve please post it. bobh. |
#7
|
|||
|
|||
![]()
On Nov 12, 3:14*am, Old Man River
wrote: Hi. In Outlook on the Tools Menu choose Options. Click the Mail Setup tab - is "Send immeadiately when connected" selected? Might help. "adma via OfficeKB.com" wrote: the same, the message stays at the outbox. Thanks for the reply Old Man River wrote: Try putting a .send at the end of your With. How are you early binding your objOL, I try that and am informed that excel doesn't know about the Outlook class. and have to dimension as an Object and use CreateObject. I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send [quoted text clipped - 23 lines] . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200911/1 .- Hide quoted text - - Show quoted text - but you still have to open outlook in order for it to connect and send bobh |
#8
|
|||
|
|||
![]()
On Nov 10, 6:17*pm, JP wrote:
This might not be the answer you're looking for, but why not just leave Outlook open? --JP On Nov 10, 3:41*pm, "adma" u56099@uwe wrote: I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send receive even if outlook closed? any help? thanks! Sub ComposeMail(strto As String, strSubject As String, strbody As String, strAttachment As String) * * Dim objOL As Outlook.Application * * Dim objX As Outlook.MailItem * * Set objOL = New Outlook.Application * * Set objX = objOL.CreateItem(olMailItem) * * With objX * * * * .To = strto * * * * .Subject = strSubject * * * * .Body = strbody * * * * If strAttachment "" Then * * * * * * .Attachments.Add strAttachment * * * * End If * * * * .BodyFormat = olFormatHTML * * * * .Display * * End With * * Application.Wait (Now + TimeValue("0:00:02")) * * Application.SendKeys "%s" End Sub- Hide quoted text - - Show quoted text - if his situation is like mine; I developed an Access application that has multiple users and I can not make the assumption that all the users will have Outlook open so when entering data on the Access data entry screen should they click the 'Notify Manager' button I want the Noticification email to be send in the background without user interaction and without having to ensure that Outlook is open which so far I have NOT been able to do using Outlook as the companies EMail client software. So the issue is why does Outlook but the email message in it's outbox instead of just sending it. bobh. |
#9
|
|||
|
|||
![]()
thats exactly what is my problem, i have searched the net for solution but
nothing yes. bobh wrote: I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send [quoted text clipped - 21 lines] Â* Â* Application.SendKeys "%s" End Sub I'm interested in doing this as well, if you find/get a resolve please post it. bobh. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200911/1 |
#10
|
|||
|
|||
![]()
it did not help , still puts it in the outbox
Old Man River wrote: Try putting a .send at the end of your With. How are you early binding your objOL, I try that and am informed that excel doesn't know about the Outlook class. and have to dimension as an Object and use CreateObject. I have this code to send email using Excel macro, it works fine abut the message stays in outbox until i open outlook then it sends it. how i can send [quoted text clipped - 23 lines] . -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...g-vba/200911/1 |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook 2007 - how to set so it doesn't receive email when closed | susankr | Outlook - General Queries | 3 | January 13th 08 12:23 AM |
Send/Receive doe not work... I can send but not receive in Outlook | Aims | Outlook - General Queries | 0 | October 31st 06 01:44 AM |
Send email immediate when Outlook 2003 is closed? | directjj | Add-ins for Outlook | 1 | May 17th 06 03:36 PM |
Automatic send/receive times out; manual send/receive works fine | TN | Outlook - Installation | 1 | March 17th 06 10:45 PM |
Even when the program is closed, it continues to send and receive | Cuervo | Outlook - Installation | 0 | January 29th 06 11:40 PM |