A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to Send Multiple Emails using Outlook 2003 VBA under Exchange Server?



 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old August 12th 06, 01:26 AM posted to microsoft.public.outlook.program_vba
[email protected]
external usenet poster
 
Posts: 1
Default How to Send Multiple Emails using Outlook 2003 VBA under Exchange Server?

I've written an Outlook 2003 VBA script which creates multiple emails
in the drafts box. I'd like to send them all, but at the 100th "send"
command the system chokes, and the emails get moved or deleted, but are
not actually sent out.

Here's my code:

Sub SendMerge()
Dim oItem As MailItem
Dim olfldrSource As MAPIFolder
Dim nSendCount As Integer
nSendCount = 1
doneScan = False
While (doneScan = False)
Set olfldrSource =
Outlook.GetNamespace("MAPI").GetDefaultFolder(olFo lderDrafts)
If (olfldrSource.Items.count() = 0) Then
doneScan = True
End If
Set oItem = olfldrSource.Items(1)
DoEvents
Debug.Print nSendCount & " Sending: " & oItem.To & " Email:
" & oItem.Subject
nSendCount = nSendCount + 1
oItem.Send
Set oItem = Nothing
Set olfldrSource = Nothing
Wend
End Sub

I know similar problems have been discussed before, but I've not seen a
conclusive answer. After reading the boards, I believe the problem is
that I've exceeded the number of COM objects allowed by the Exchange
Server, but this is just a guess.

I've also seen posts about explicit Garbage Collection above and beyond
setting all Objects = Nothing, but I've seen no examples on how to do
this.

Does anyone have any suggestions? What am I doing wrong and how do I
fix this?

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot connect to Exchange server from Outlook client on Windows 2003 Server AllenM Outlook - General Queries 0 May 16th 06 07:44 PM
Multiple email accounts from exchange server in Outlook. Joao Outlook - General Queries 2 March 10th 06 11:25 PM
Multiple accounts on one exchange server Outlook 2003 pk Outlook - Installation 2 January 31st 06 07:13 AM
Automatically trigger a VBA macro to run when connection to exchange server has been made. [email protected] Outlook and VBA 1 January 30th 06 11:29 PM
Automatically trigger a VBA macro to run when connection to exchange server has been made. [email protected] Outlook and VBA 0 January 25th 06 09:52 PM


All times are GMT +1. The time now is 09:18 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-2025 Outlook Banter.
The comments are property of their posters.