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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Outlook.MAPIFolder: for each compile error



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 28th 07, 06:16 PM posted to microsoft.public.outlook.program_addins
spareway
external usenet poster
 
Posts: 11
Default Outlook.MAPIFolder: for each compile error

When I try to compile this:

foreach (Outlook.MAPIFolder tmpFolder in theFolder.Folders)
{
MesageBox.Show(tmpFolder.Name);
}


I get this:

foreach statement cannot operate on variables of type
'Outlook.Folders' because 'Outlook.Folders' does not contain a
definition for 'GetEnumerator', or it is inaccessible

Anyone know what is the problem?

thanks,

craig

  #2  
Old January 29th 07, 02:05 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Outlook.MAPIFolder: for each compile error

The problem is you can't use foreach, as the error says. Use a for loop
instead. It's actually faster anyway.

--
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


"spareway" wrote in message
ups.com...
When I try to compile this:

foreach (Outlook.MAPIFolder tmpFolder in theFolder.Folders)
{
MesageBox.Show(tmpFolder.Name);
}


I get this:

foreach statement cannot operate on variables of type
'Outlook.Folders' because 'Outlook.Folders' does not contain a
definition for 'GetEnumerator', or it is inaccessible

Anyone know what is the problem?

thanks,

craig


 




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
Project Won't Run or Compile Ron Outlook and VBA 6 January 23rd 07 02:24 AM
Help -Outlook.MAPIFolder, VBA macros lerneree Outlook and VBA 1 September 6th 06 12:59 PM
What is: Compile Error in hidden module: AutoExecNew Guitar125 Outlook and VBA 1 July 7th 06 05:52 AM
Outlook 2002 (XP) - MAPIFolder.Description - Runtime Error -2113470450 Johannes Harth Outlook and VBA 3 June 30th 06 09:34 PM
How do I compile statistics about meetings? Stu Detroit Outlook - Calandaring 0 March 9th 06 09:25 PM


All times are GMT +1. The time now is 04:21 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.