![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
hi to all
i have code for getting contact folders from outlook. but when i was colllect all folders name in one variable and then getting for which is contact folder i use FOR EACH loop. that time it is giving error saying that that varible is not collection type i type my code here Dim oFolder As Outlook.MAPIFolder Dim colFolders As Outlook.Folders On Error Resume Next colFolders = oSourceFolder.Folders If Not (colFolders Is Nothing) Then For Each oFolder In colFolders If colFolders.DefaultItemType = olContactItem Then 'do whatever End If 'recursive call to SetAllContactFolders. 'repeat until no more subfolders Call SetAllContactFolders(oFolder) Next End If oFolder = Nothing colFolders = Nothing it is giving error at FOR EACH oFolder in ColFolders . so error at ColFolders. ok so what's prob is. thanks |
Ads |
#2
|
|||
|
|||
![]()
See if it works if you change this line:
If colFolders.DefaultItemType = olContactItem Then to this: If oFolder.DefaultItemType = olContactItem Then -- 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 "Sanjay" wrote in message oups.com... hi to all i have code for getting contact folders from outlook. but when i was colllect all folders name in one variable and then getting for which is contact folder i use FOR EACH loop. that time it is giving error saying that that varible is not collection type i type my code here Dim oFolder As Outlook.MAPIFolder Dim colFolders As Outlook.Folders On Error Resume Next colFolders = oSourceFolder.Folders If Not (colFolders Is Nothing) Then For Each oFolder In colFolders If colFolders.DefaultItemType = olContactItem Then 'do whatever End If 'recursive call to SetAllContactFolders. 'repeat until no more subfolders Call SetAllContactFolders(oFolder) Next End If oFolder = Nothing colFolders = Nothing it is giving error at FOR EACH oFolder in ColFolders . so error at ColFolders. ok so what's prob is. thanks |
#3
|
|||
|
|||
![]()
Hi ken
Thanks for reply. Now I have problem with this line not which u have said. For Each oFolder In colFolders In this line it is giving error that "colFolders is not a collection type". so what i have to use or which type i have to declare for that solving error. |
#4
|
|||
|
|||
![]()
Maybe there are no subfolders? Try testing for oSourceFolder.Folders.Count.
Folders is definitely a collection object. -- 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 "Sanjay" wrote in message oups.com... Hi ken Thanks for reply. Now I have problem with this line not which u have said. For Each oFolder In colFolders In this line it is giving error that "colFolders is not a collection type". so what i have to use or which type i have to declare for that solving error. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I sort events on my calendar by label or type? | djrtowle | Outlook - Calandaring | 5 | August 15th 06 10:16 PM |
The current document type cannot be sent as mail | Teddy Banks | Outlook Express | 12 | March 31st 06 03:20 AM |
How can I print to a dayrunner type calendar | lou | Outlook - Calandaring | 1 | February 10th 06 10:54 AM |
how do i find type of mail opened? | Sue Mosher [MVP-Outlook] | Outlook - Using Forms | 0 | February 6th 06 09:13 PM |
Open an attachement of type olEmbeddeditem | Nuno | Add-ins for Outlook | 3 | January 16th 06 06:09 PM |