Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Messages stuck in outbox (http://www.outlookbanter.com/outlook-vba/21672-messages-stuck-outbox.html)

mecg96 July 24th 06 09:51 PM

Messages stuck in outbox
 
Hi!
I'm sending emails and saving the same item to a .pst. I am changing the
sent item destination using:
StoreID = objDestinationFolder.StoreID
FolderID = objDestinationFolder.EntryID
Set olNewMessage.SaveSentMessageFolder = objDestinationFolder

It is working fine, but when all the messages are sent the outbox still
shows all the emails there. It seems like it won't move the sent items to the
..pst until I do a "send and receive" (F9). Is there a way to do this from
code? or how can I avoid saving it to the sent items at all?

Thanks!!

Ken Slovak - [MVP - Outlook] July 25th 06 03:07 PM

Messages stuck in outbox
 
You can find the CommandBarControl that represents the Send/Receive menu
item and call its Execute method to perform a Send/Receive action.

Try the DeleteAfterSubmit Boolean, set it true on the mail item and no copy
will be saved after sending.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"mecg96" wrote in message
...
Hi!
I'm sending emails and saving the same item to a .pst. I am changing the
sent item destination using:
StoreID = objDestinationFolder.StoreID
FolderID = objDestinationFolder.EntryID
Set olNewMessage.SaveSentMessageFolder = objDestinationFolder

It is working fine, but when all the messages are sent the outbox still
shows all the emails there. It seems like it won't move the sent items to
the
.pst until I do a "send and receive" (F9). Is there a way to do this from
code? or how can I avoid saving it to the sent items at all?

Thanks!!



mecg96 July 25th 06 04:01 PM

Messages stuck in outbox
 
Hi Ken,

Thanks for the help. It's working now, but I have another problem. After all
the messages are sent I close the .pst file. The problem is that for the last
messages the send/receive is still active when the close .pst command
executes. I tried with the "Doevents" after the Send/Receive, but it didn't
work. Is there a way of telling the macro to wait until the send/receive
finishes?

Thx!



"Ken Slovak - [MVP - Outlook]" wrote:

You can find the CommandBarControl that represents the Send/Receive menu
item and call its Execute method to perform a Send/Receive action.

Try the DeleteAfterSubmit Boolean, set it true on the mail item and no copy
will be saved after sending.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"mecg96" wrote in message
...
Hi!
I'm sending emails and saving the same item to a .pst. I am changing the
sent item destination using:
StoreID = objDestinationFolder.StoreID
FolderID = objDestinationFolder.EntryID
Set olNewMessage.SaveSentMessageFolder = objDestinationFolder

It is working fine, but when all the messages are sent the outbox still
shows all the emails there. It seems like it won't move the sent items to
the
.pst until I do a "send and receive" (F9). Is there a way to do this from
code? or how can I avoid saving it to the sent items at all?

Thanks!!




Ken Slovak - [MVP - Outlook] July 26th 06 02:14 PM

Messages stuck in outbox
 
There's no way to tell if the send/receive is finished usually.

You can use the SyncObjects collection and initiate a synch in your code and
then handle the synch end event. That would work, usually most people have 1
defined send/receive group, but if there are more it can be very hard to
tell which accounts are being sent with which groups.

Look at http://www.outlookcode.com/threads.a...essageid=16184
for some sample code using syncobjects, it might help.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"mecg96" wrote in message
...
Hi Ken,

Thanks for the help. It's working now, but I have another problem. After
all
the messages are sent I close the .pst file. The problem is that for the
last
messages the send/receive is still active when the close .pst command
executes. I tried with the "Doevents" after the Send/Receive, but it
didn't
work. Is there a way of telling the macro to wait until the send/receive
finishes?

Thx!




All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com