![]() |
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
|
|||
|
|||
![]()
I have created a folder called "Forwarded" and I am using this code:
Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String) ' Dim oFolder As MAPIFolder ' Set oFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderInbo x) Dim arr() As String Dim i As Integer Dim m As MailItem On Error Resume Next arr = Split(EntryIDCollection, ",") For i = 0 To UBound(arr) Set m = Application.Session.GetItemFromID(arr(i)) m.To = " AddNewItemToFolder (m) m.Send Next End Sub Public Sub AddNewItemToFolder(oItem As MailItem) Dim oFolder As MAPIFolder Set oFolder = GetNamespace("MAPI").Folders.Item("Forwarded") oFolder.Items.Add (oItem) End Sub But Even though I have a breakpoint in AddNewItemToFolder, I never get there. It's as if the call to this subroutine were commented out. |
Ads |
#2
|
|||
|
|||
![]()
Firstly, do not try to send a message that has already been received. Create
a new message (Application.CreateItem or MAPIFolder.Items.Add), populate its properties, then send, Secondly. Items.Add create a brand new item and takes either an OlItemType enum (e.g. olMailItem) or a string indicating teh desired message class (e.g. "IPM.Note"). If you want to move an existing item to a folder, use MailItem.Move(). Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "RON" wrote in message ... I have created a folder called "Forwarded" and I am using this code: Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String) ' Dim oFolder As MAPIFolder ' Set oFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderInbo x) Dim arr() As String Dim i As Integer Dim m As MailItem On Error Resume Next arr = Split(EntryIDCollection, ",") For i = 0 To UBound(arr) Set m = Application.Session.GetItemFromID(arr(i)) m.To = " AddNewItemToFolder (m) m.Send Next End Sub Public Sub AddNewItemToFolder(oItem As MailItem) Dim oFolder As MAPIFolder Set oFolder = GetNamespace("MAPI").Folders.Item("Forwarded") oFolder.Items.Add (oItem) End Sub But Even though I have a breakpoint in AddNewItemToFolder, I never get there. It's as if the call to this subroutine were commented out. |
#3
|
|||
|
|||
![]()
That worked! Thanks.
"Dmitry Streblechenko" wrote: Firstly, do not try to send a message that has already been received. Create a new message (Application.CreateItem or MAPIFolder.Items.Add), populate its properties, then send, Secondly. Items.Add create a brand new item and takes either an OlItemType enum (e.g. olMailItem) or a string indicating teh desired message class (e.g. "IPM.Note"). If you want to move an existing item to a folder, use MailItem.Move(). Dmitry Streblechenko (MVP) http://www.dimastr.com/ OutlookSpy - Outlook, CDO and MAPI Developer Tool "RON" wrote in message ... I have created a folder called "Forwarded" and I am using this code: Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String) ' Dim oFolder As MAPIFolder ' Set oFolder = GetNamespace("MAPI").GetDefaultFolder(olFolderInbo x) Dim arr() As String Dim i As Integer Dim m As MailItem On Error Resume Next arr = Split(EntryIDCollection, ",") For i = 0 To UBound(arr) Set m = Application.Session.GetItemFromID(arr(i)) m.To = " AddNewItemToFolder (m) m.Send Next End Sub Public Sub AddNewItemToFolder(oItem As MailItem) Dim oFolder As MAPIFolder Set oFolder = GetNamespace("MAPI").Folders.Item("Forwarded") oFolder.Items.Add (oItem) End Sub But Even though I have a breakpoint in AddNewItemToFolder, I never get there. It's as if the call to this subroutine were commented out. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
add inline image to MailItem programmatically | dragooon | Outlook and VBA | 1 | September 27th 06 01:09 AM |
Cannot add folder | Mr Graham J Cook | Outlook Express | 1 | September 15th 06 01:35 PM |
Help - can't add "Item" (of type MailItem) using Attachments.Add() | [email protected] | Outlook and VBA | 1 | August 3rd 06 06:55 AM |
MailItem Folder Path | Fox via OfficeKB.com | Outlook and VBA | 1 | July 7th 06 03:39 PM |
How can I create a MailItem that displays like a received MailItem ? | Clive | Outlook - Using Forms | 0 | February 27th 06 05:14 PM |