![]() |
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
|
|||
|
|||
![]() Outlook Experts, I am new to Outlook Programmming having worked before with Excel VBA. In Outlook, I highlight an e-mail, read it in the window, and then copy it to another folder. After I've copied it to the other folder, I change the flag to a red color. I want to write a macro that will automate this. The folder that the e-mail is moved to is Public Folders\All Public Folders\OP's\Derivatives\OTC Derivatives\Fish & Nadl I gave the code a try based on a book and looking at some other posts. Three things I didn't know how to do: 1) Set objItem to the current e-mail which is highlighted. 2) Set objDestinationFolder - I'm not sure how to specify a folder 3) Set the flag of the item in its original folder to red Below is the code I came up with. I'd appreciate help in fixing the three above issues and any other problems I may have created. Thanks, Alan Sub MoveEmailToFish() Dim ObjApp As Outlook.Application Dim ObjNS As Outlook.NameSpace Dim objItem As Object Dim objDestinationFolder As Outlook.MAPIFolder Set ObjApp = CreateObject("Outlook.Application") Set ObjNS = ObjApp.GetNamespace("MAPI") 'Set objItem = (Current E-mail)? 'Set objDestinationFolder = _ objNS.Folders("Public Folders\All Public Folders\OP's\Derivatives\OTC DERIVATIVES\FISH & NADL") objItem.Copy objDestinationFolder 'objItem.olRedFlagIcon Set ObjApp = Nothing Set ObjNS = Nothing Set objItem = Nothing End Sub |
Ads |
#2
|
|||
|
|||
![]()
1) Set objItem to the current e-mail which is highlighted.
Application.ActiveExplorer.Selection(1) returns the first highlighted ittem. 2) Set objDestinationFolder - I'm not sure how to specify a folder To get a non-default folder, you need to walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm and, especially for public folders, http://www.outlookcode.com/codedetail.aspx?id=1164 3) Set the flag of the item in its original folder to red The object browser is your friend. Take a look at the MailItem.FlagIcon property - http://msdn.microsoft.com/library/en...HV01121155.asp -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "achidsey" wrote in message ... Outlook Experts, I am new to Outlook Programmming having worked before with Excel VBA. In Outlook, I highlight an e-mail, read it in the window, and then copy it to another folder. After I've copied it to the other folder, I change the flag to a red color. I want to write a macro that will automate this. The folder that the e-mail is moved to is Public Folders\All Public Folders\OP's\Derivatives\OTC Derivatives\Fish & Nadl I gave the code a try based on a book and looking at some other posts. Three things I didn't know how to do: 1) Set objItem to the current e-mail which is highlighted. 2) Set objDestinationFolder - I'm not sure how to specify a folder 3) Set the flag of the item in its original folder to red Below is the code I came up with. I'd appreciate help in fixing the three above issues and any other problems I may have created. Thanks, Alan Sub MoveEmailToFish() Dim ObjApp As Outlook.Application Dim ObjNS As Outlook.NameSpace Dim objItem As Object Dim objDestinationFolder As Outlook.MAPIFolder Set ObjApp = CreateObject("Outlook.Application") Set ObjNS = ObjApp.GetNamespace("MAPI") 'Set objItem = (Current E-mail)? 'Set objDestinationFolder = _ objNS.Folders("Public Folders\All Public Folders\OP's\Derivatives\OTC DERIVATIVES\FISH & NADL") objItem.Copy objDestinationFolder 'objItem.olRedFlagIcon Set ObjApp = Nothing Set ObjNS = Nothing Set objItem = Nothing End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Outlook should make it EASIER to move the flag column. | Grapevine_Tom | Outlook - Installation | 1 | September 7th 06 10:53 PM |
Move flag column | SStory | Outlook - General Queries | 3 | July 26th 06 12:51 AM |
How can I move the flag icon to the front of each line? | Angela | Outlook - Calandaring | 2 | July 12th 06 04:25 PM |
New mail notification should not show a red flag | jader3rd | Outlook - General Queries | 1 | May 25th 06 08:32 PM |
Can not move or copy message having "flag complete" | Vinayakc | Add-ins for Outlook | 1 | February 23rd 06 04:48 PM |