Send/Receive while outlook closed?

  • Thread starter Thread starter adma
  • Start date Start date
Status
Not open for further replies.
A

adma

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
 
This might not be the answer you're looking for, but why not just

leave Outlook open?
 
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.
 
Hi. In Outlook on the Tools Menu choose Options. Click the Mail Setup tab -

is "Send immeadiately when connected" selected? Might help.
 
I'm interested in doing this as well, if you find/get a resolve please post it.

bobh.
 
but you still have to open outlook in order for it to connect and send

bobh
 
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.
 
thats exactly what is my problem, i have searched the net for solution but

nothing yes.
 
I understand your (and everyone else's) concern regarding this issue,

but there is a solution: leave Outlook open. Who doesn't leave it open

all day to get meeting reminders, receive important emails from the

boss, etc anyway?

If you want to send an email without user interaction, and you must

use Outlook, try using Redemption (redemption/). Or see http://www.rondebruin.nl/sendmail.htm for other

tips.

As a workaround, use GetObject to see if Outlook is open, and if it

isn't, warn your end users (via MsgBox) that without Outlook open,

their messages will be delayed.
 
i used redemption, copied installed it added to reference library

i copied their example into a sub for testing

Sub redemail()

Dim SafeItem, oItem

Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of

Redemption.SafeMailItem

Set oItem = Application.CreateItem(0) 'Create a new message

SafeItem.Item = oItem 'set Item property

SafeItem.Recipients.Add "myemail@mycompany.com"

SafeItem.Recipients.ResolveAll

SafeItem.Subject = "Testing Redemption"

SafeItem.Send

End Sub

here is the error

run-time error '438':

Object doesn't support this property or method at this line

'Set oItem = Application.CreateItem(0) 'Create a new message

what shall i do?

any help?
 
You're in Excel, trying to use code written for Outlook. You need to

create an instance of Outlook.Application, then use that reference.

i.e.

Dim olApp As Outlook.Application

Set olApp = CreateObject("Outlook.Application")

Set oItem = olApp.CreateItem(0) 'Create a new message
 
i have this code which worked fine but still can not send it out unless i

open outlook

i have outlook 2003

i am sooo sadddddd

Sub redmail()

Dim SafeItem, oItem

Dim objOL As Outlook.Application

Dim objX As Outlook.MailItem

Set objOL = New Outlook.Application

Set objX = objOL.CreateItem(0)

Set SafeItem = CreateObject("Redemption.SafeMailItem") 'Create an instance of

Set oItem = objOL.CreateItem(0) 'Create a new message

SafeItem.Item = oItem 'set Item property

SafeItem.Recipients.Add "myemai@company.com"

SafeItem.Subject = "Deamdn File"

SafeItem.Recipients.ResolveAll

SafeItem.Send

End Sub
 
Hi adma.

I was just browsing Outlook Object Model and found this

Sub SendAndReceive(showProgressDialog As Boolean)

Member of Outlook.NameSpace

Remembering your request you could try objOL.Namespace.SendAndRecieve(False)

No Guarantees as I haven't used it. (You might test Namespace to see if its

null though.)
 
Another glance at the Outlook object browser would tell you why it won't

work: There is no Application.Namespace property. There is, however, an

Application.Session property that returns a Namespace object, thus:

objOL.Session.SendAndReceive(False), assuming you have a valid objOL

(Outlook.Application) object.

Sue Mosher
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
E FUNCTION SEND/RECEIVE OUTLLOK AND VB6 Outlook VBA and Custom Forms 3
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
R How to restrict GWSMO sync to Outlook Send/Receive cycles Using Outlook 0
C Synchronizing subscribed folders causes hanging during send/receive process Using Outlook 2
C Send/receive error 80040119 Using Outlook 2
ChrisK2 Send email to advertise@slipstick.com fails: "The group advertising isn't set up to receive messages from..." Using Outlook 3
M Send/Receive error 0x800CCC0F Using Outlook 0
N Outlook 2010 will not send nor receive Using Outlook 4
L Outlook 2007 Separate the Send/Receive functions Using Outlook 2
L How to automaticlly Send/Receive every 3 mins but override send if send/receive is pressed Using Outlook 2
Diane Poremsky Configuring a Manual Send and Receive in Outlook Using Outlook 0
M configure Onpremise exchange to send/receive emails internally and externally) Exchange Server Administration 0
P Outlook 2007 not sending/receiving until restart (send/receive stuck at __%) Using Outlook 27
J Send and Receive Button - only check default account? Using Outlook 1
S send/receive issues outlook 2013 Using Outlook 4
W OUTLOOK 2007 FREEZES. WILL NOT SEND NOR RECEIVE Using Outlook 1
Z Always Send from Default Account, depend of receive account Outlook VBA and Custom Forms 7
wisedave Office 365 Outlook - Emails send but don't receive Using Outlook 12
D Outlook 2010 hangs during message send/receive Using Outlook 2
S Outlook 2010 I am getting error code 0x8DE00006 'the operation failed'. outlook 2010 send/receive progress Using Outlook.com accounts in Outlook 2
Nesher Can send but not receive Using Outlook 1
David Trevose Hanging on Send Receive Using Outlook 2
mikecox "Send/Receive" goes missing Using Outlook 3
R Email Send & Receive Turned off but sends automatically anyway Using Outlook 1
N Outlook 2010 take long time in send / receive Using Outlook 1
J why won't the automatic send/receive work Using Outlook 7
A Auto send-receive in Outlook not working Using Outlook 6
R send/receive no action Using Outlook 2
A yahoo mail doesn't send or receive reliably Using Outlook 1
E Strange Send/Receive count Using Outlook 3
Jennifer Murphy Why would I want to send/receive when offline? Using Outlook 0
S Send/Receive Progress is black??? Using Outlook 4
M Send receive Progress Box Using Outlook 4
0 Outlook 2010 causes computer to lose connection when opening and Send/Receive Using Outlook.com accounts in Outlook 14
D Emails stuck in Outbox, not receiving emails, Outlook 2010 auto send/receive Using Outlook 4
A Send only, don't receive Using Outlook 1
K Send/Receive All Folders doesn't show Progress status Using Outlook 14
H Send/Receive Error Sending E-Mails Using POP3 GMail Account Using Outlook 2
J Correct settings for send/receive groups w/Exchange Using Outlook 3
T Changed password now can't send/receive Using Outlook 1
T Outlook 2010 manually actioning of send and receive? remove auto actioning Using Outlook 4
J Send/receive getting stuck Using Outlook.com accounts in Outlook 1
X Send & receive takes SO LONG Using Outlook 1
P Send/Receive error in Outlook 2007 Using Outlook 2
W Send/Receive status bar Using Outlook 0
O two profiles send/receive from different servers Using Outlook 1
S Error code 0x8004102A Error With Send/Receive Using Outlook.com accounts in Outlook 2
S Connector Forces Outlook 2007 To Hang On Send/Receive Using Outlook.com accounts in Outlook 3
L Send/receive error (0X800CCC80) Using Outlook 2

Similar threads

Back
Top