Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 30th, 2003, 09:38 AM
Authorized User
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outlook 2000 VBA - Receive mail...

I have been using "Outlook 2000 VBA" for the last couple of years and developed various applications to enhance my version of Outlook 2000. The current project I am working on is an anti-spam system.

My goal is to check emails (Deleting the spam) whilst they are still on the server before normal retrieval by Outlook 2000. I have easily achieved most of this using various POP3 libraries but now want Outlook to download the remaining mails only when the server has been "cleaned".

How do I programmatically, through the Outlook object model, cause Outlook to check for new messages. Manually, one would do this by:
a) Pressing F5;
b) Pressing the Send/Receive button, OR;
c) Tools - Send/Receive - All Accounts

Obviously I would like my application to be running in the background (Or regularly scheduled), downloading the non-spam email at regular intervals - similar to the "Mail Delivery" option of check for new messages every X, however not being driven by Outlook but instead my external application.

I have found the CreateItem method but nothing comparable for retrieving mail.

Thanks for any help that can be offered,


Reply With Quote
  #2 (permalink)  
Old July 17th, 2003, 08:49 AM
Registered User
Join Date: Jul 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


Reply With Quote
  #3 (permalink)  
Old July 17th, 2003, 02:56 PM
Authorized User
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts

Many thanks to Riouxnick for this pointer. Rather than writing in VB, I am in fact using Visual FoxPro, so have found that the example text pointed to needed some modifications.

In case anyone is wondering, here is the solution that I found to work:
************************************************** ******
LOCAL loOutlook, loCommandBarCollection, loStandardCB
loOutlook = CREATEOBJECT("outlook.application")
= loOutlook.GetNameSpace("MAPI").GetDefaultFolder(6) .GetExplorer && Make sure that a mail folder (I have chosen the Inbox) is active, even if still hidden - as one can't Send/Receive from say a Notes folder
loCommandBarCollection = loOutlook.ActiveExplorer.CommandBars
FOR x = 1 TO loCommandBarCollection.Count
    IF PADR(UPPER(loCommandBarCollection.Item(x).Name), 10) = "STANDARD "
        loStandardCB = loCommandBarCollection.Item(x)
IF TYPE("loStandardCB") # "O" && Just incase the Standard toolbar can't be found
    RETURN .F.
= loStandardCB.Controls("Send/Receive").Execute
************************************************** ******
Reply With Quote

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
E-mail using VBA and Outlook cc16 Access VBA 6 December 4th, 2006 11:07 AM
send/receive in MS Outlook dotnetprogrammer VS.NET 2002/2003 0 February 25th, 2005 12:01 AM
Receiving mail with Outlook 2000 VBA spotts-71 All Other Wrox Books 3 August 24th, 2004 10:41 AM
Outlook 2000, VBA, random signatures michaelrayadkins Beginning VB 6 1 June 4th, 2004 07:49 AM
Receiving mail with Outlook 2000 VBA spotts-71 Pro VB 6 7 July 17th, 2003 03:04 PM

All times are GMT -4. The time now is 01:53 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.