![]() |
Help for writing an Outlook 2007 macro
Hello .... I was wondering if someone could assist me in writing a macro for
Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM |
Help for writing an Outlook 2007 macro
Do you want to learn VBA and write the code yourself? Then start with the object browser (f2), which helps you to get familiar with the object model of Outlook. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM |
Help for writing an Outlook 2007 macro
Michael,
Thanks for you reply but I don't understand it. I hit F2 while Outlook is open and nothing happens. Do you mean to open up the windows that says "VBAProject.OTM [design]" at the top? If so, I did that but I don't know where to begin. Either someone needs to point me to an easy-to-understand tutorial on the subject of writing these macros or get me started by posting some code. --LGM "Michael Bauer [MVP - Outlook]" wrote: Do you want to learn VBA and write the code yourself? Then start with the object browser (f2), which helps you to get familiar with the object model of Outlook. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM . |
Help for writing an Outlook 2007 macro
First open the VBA editor (alt+f11), then the object browser (f2). Switch from All Libraries to Outlook. If you select any object left hand or an object's property or function right hand and press f1, you'll get help and often a code sample, too. A function that can be called from a toolbar button must be declared like this: Public Sub Whatever() ' your code here End Sub The item selected in a folder can be accessed through the Selection colllection of the active Explorer object. The active Explorer is accessible via Application.ActiveExplorer. So, these are your first keywords to look into the object browser for more help: ActiveExplorer, and Selection. The category of an item is stored in its Categories property. If you want to file the items in Outlook (as opposed to the Windows file system), see the MapiFolder object. Each MapiFolder object has a Folders collection for its subfolders, and an Add function for creating a new subfolder. To start with one folder, you might call GetDefaultFolder(olFolderInbox), which returns the default Inbox. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Wed, 16 Dec 2009 10:45:02 -0800 schrieb LGM: Michael, Thanks for you reply but I don't understand it. I hit F2 while Outlook is open and nothing happens. Do you mean to open up the windows that says "VBAProject.OTM [design]" at the top? If so, I did that but I don't know where to begin. Either someone needs to point me to an easy-to-understand tutorial on the subject of writing these macros or get me started by posting some code. --LGM "Michael Bauer [MVP - Outlook]" wrote: Do you want to learn VBA and write the code yourself? Then start with the object browser (f2), which helps you to get familiar with the object model of Outlook. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM . |
Help for writing an Outlook 2007 macro
This is way over my head. Thanks anyway. I'll just do without it. "Michael Bauer [MVP - Outlook]" wrote: First open the VBA editor (alt+f11), then the object browser (f2). Switch from All Libraries to Outlook. If you select any object left hand or an object's property or function right hand and press f1, you'll get help and often a code sample, too. A function that can be called from a toolbar button must be declared like this: Public Sub Whatever() ' your code here End Sub The item selected in a folder can be accessed through the Selection colllection of the active Explorer object. The active Explorer is accessible via Application.ActiveExplorer. So, these are your first keywords to look into the object browser for more help: ActiveExplorer, and Selection. The category of an item is stored in its Categories property. If you want to file the items in Outlook (as opposed to the Windows file system), see the MapiFolder object. Each MapiFolder object has a Folders collection for its subfolders, and an Add function for creating a new subfolder. To start with one folder, you might call GetDefaultFolder(olFolderInbox), which returns the default Inbox. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Wed, 16 Dec 2009 10:45:02 -0800 schrieb LGM: Michael, Thanks for you reply but I don't understand it. I hit F2 while Outlook is open and nothing happens. Do you mean to open up the windows that says "VBAProject.OTM [design]" at the top? If so, I did that but I don't know where to begin. Either someone needs to point me to an easy-to-understand tutorial on the subject of writing these macros or get me started by posting some code. --LGM "Michael Bauer [MVP - Outlook]" wrote: Do you want to learn VBA and write the code yourself? Then start with the object browser (f2), which helps you to get familiar with the object model of Outlook. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM . . |
Help for writing an Outlook 2007 macro
Hi, Michael (or anyone else interested) - This is over my head, too, but I'd like to continue the thread briefly if you don't mind. I've swiped some code, I mean, done a little VBA programming in Word and am new to Outlook 2007 and its object model. I'm trying to re-create a function that I first used in T'bird to keep my mailbox size down, back when we had a 15MB limit. Can you advise me how or where to get started with it? In T'bird, I used the tags feature to mark email as it came in - red for 'ToDo', etc., and gray for 'ToDelete'. Flagging a message as 'ToDelete' moved it to a separate folder; and that folder was configured to permanently delete anything over X days old. This way, I could clear messages out of my Inbox with a single keystroke but hold onto them for a few weeks longer, just in case. So what I think I want to do is to write a macro to move messages categorized as 'ToDelete' to another folder, then set the archive settings to permanently delete those of a certain age. I'm guessing that would be easier than to archive only the old messages in that category in the Inbox. (I have a Search Folder to filter for my 'ToDelete' messages but can't archive those. Sorry to keep running on. Thanks for any insight you can offer. LGM;108049 Wrote: This is way over my head. Thanks anyway. I'll just do without it. "Michael Bauer [MVP - Outlook]" wrote: First open the VBA editor (alt+f11), then the object browser (f2). Switch from All Libraries to Outlook. If you select any object left hand or an object's property or function right hand and press f1, you'll get help and often a code sample, too. .... -[abbreviated quote]- Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM . . [/color][/color] -- Mike T http://forums.slipstick.com |
Help for writing an Outlook 2007 macro
Why don't you just delete the message, which moves it with a single click into the Deleted Items folder? For that folder you can use the archive setting to clean messages older than x days. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 22 Dec 2009 10:41:49 -0500 schrieb Mike T: Hi, Michael (or anyone else interested) - This is over my head, too, but I'd like to continue the thread briefly if you don't mind. I've swiped some code, I mean, done a little VBA programming in Word and am new to Outlook 2007 and its object model. I'm trying to re-create a function that I first used in T'bird to keep my mailbox size down, back when we had a 15MB limit. Can you advise me how or where to get started with it? In T'bird, I used the tags feature to mark email as it came in - red for 'ToDo', etc., and gray for 'ToDelete'. Flagging a message as 'ToDelete' moved it to a separate folder; and that folder was configured to permanently delete anything over X days old. This way, I could clear messages out of my Inbox with a single keystroke but hold onto them for a few weeks longer, just in case. So what I think I want to do is to write a macro to move messages categorized as 'ToDelete' to another folder, then set the archive settings to permanently delete those of a certain age. I'm guessing that would be easier than to archive only the old messages in that category in the Inbox. (I have a Search Folder to filter for my 'ToDelete' messages but can't archive those. Sorry to keep running on. Thanks for any insight you can offer. LGM;108049 Wrote: This is way over my head. Thanks anyway. I'll just do without it. "Michael Bauer [MVP - Outlook]" wrote: First open the VBA editor (alt+f11), then the object browser (f2). Switch from All Libraries to Outlook. If you select any object left hand or an object's property or function right hand and press f1, you'll get help and often a code sample, too. .... -[abbreviated quote]- Am Tue, 15 Dec 2009 10:46:01 -0800 schrieb LGM: Hello .... I was wondering if someone could assist me in writing a macro for Outlook 2007 that would file contacts with previously assigned categories into subfolders that have the same name as those categories. For example, if a contact had a category designation of "Restaurants" the macro would file it in a subfolder called "Restaurants" Also, if a contact did not have any category listed for it, then it would be filed in a folder called "Unfiled" I would also like to be able to assign this script/macro to a one-button and put it in a taskbar or menu in Outlook. Can someone help? I am a TOTAL newbie to scripts so I need explicit instructions. Thanks in advance. --LGM . . [/color][/color] |
Help for writing an Outlook 2007 macro
Yours is a perfectly reasonable approach, but where's the fun in that?!? I'm a tinkerer by nature and I guess my real aim is to use this 'problem' as an excuse to re-learn some VBA. It's been years since I wrote anything on my own, and I've forgotten most of what I knew or fallen behind. So I'm looking for good reference materials (in print or online) and other sources of info I can use to learn more of the science and the art of it. Thanks again for your insight. - Mike T 'Michael Bauer [MVP - Outlook Wrote: [color=blue] ;108811']Why don't you just delete the message, which moves it with a single click into the Deleted Items folder? For that folder you can use the archive setting to clean messages older than x days. -- Best regards Michael Bauer - MVP Outlook Manage and share your categories: http://www.vboffice.net/product.html?pub=6&lang=en Am Tue, 22 Dec 2009 10:41:49 -0500 schrieb Mike T: [color=blue] Hi, Michael (or anyone else interested) - This is over my head, too, but I'd like to continue the thread briefly if you don't mind. I've swiped some code, I mean, done a little VBA programming in Word and am new to Outlook 2007 and its object model. I'm trying to re-create a function that I first used in T'bird to keep my mailbox size down, back when we had a 15MB limit. Can you advise me how or where to get started with it? In T'bird, I used the tags feature to mark email as it came in - red for 'ToDo', etc., and gray for 'ToDelete'. Flagging a message as 'ToDelete' moved it to a separate folder; and that folder was configured to permanently delete anything over X days old. This way, I could clear messages out of my Inbox with a single keystroke but hold onto them for a few weeks longer, just in case. So what I think I want to do is to write a macro to move messages categorized as 'ToDelete' to another folder, then set the archive settings to permanently delete those of a certain age. I'm guessing that would be easier than to archive only the old messages in that category in the Inbox. (I have a Search Folder to filter for my 'ToDelete' messages but can't archive those. Sorry to keep running on. Thanks for any insight you can offer. LGM;108049 Wrote: This is way over my head. Thanks anyway. I'll just do without it. -[rest of thread deleted to save space]- -- Mike T http://forums.slipstick.com |
All times are GMT +1. The time now is 02:28 PM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com