|
|
| Next: Updating a TASK |
| Author |
Message |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 1
|
Posted: Fri Dec 10, 2004 9:23 am Post subject: create a macro to move outlook 2003 message to a specific fo Archived from groups: microsoft>public>outlook>program_vba (more info?) |
|
|
I need a second message 'delete' button that doesn't truly delete a message
but moves it to a specified folder. Has anyone already written an Outlook
2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
Outlook to jump start macro building is beyond me.)
The reason is that I concurrently manage two on-line 'personalities' for
different employers and do not want the messages from one personality
auto-archived to the other personality's archive files.
I can auto-segregate incoming messages by email account, I can
auto-segregate out-going messages by email account using the Rules Wizard -
but I cannot do this with deleted messages. (for legal reasons, I never
actually delete anything). |
|
| Back to top |
|
 |
Eric Legault [MVP - Outlo External

Since: Apr 22, 2004 Posts: 778
|
Posted: Fri Dec 10, 2004 9:57 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
If you are essentially just moving the message rather than deleting it, would
using the File -> Move To Folder... command inside the message (or
right-click the message, Move To Folder... / Edit -> Move To Folder... in the
folder view) be sufficient for your needs?
If it is the same folder you are always moving the message to, you can use
the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
message to a previously declared MAPIFolder variable.
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>
"Jim Johnson - Serenity Consulting" wrote:
> I need a second message 'delete' button that doesn't truly delete a message
> but moves it to a specified folder. Has anyone already written an Outlook
> 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> Outlook to jump start macro building is beyond me.)
>
> The reason is that I concurrently manage two on-line 'personalities' for
> different employers and do not want the messages from one personality
> auto-archived to the other personality's archive files.
>
> I can auto-segregate incoming messages by email account, I can
> auto-segregate out-going messages by email account using the Rules Wizard -
> but I cannot do this with deleted messages. (for legal reasons, I never
> actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Fri Dec 10, 2004 10:41 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Well thanks, but that is only half the answer I was looking for.
I know about the 'Move to Folder' option. It is what I am doing now and
takes twice as much work as I am looking for because you have to both select
the function, then select the destination.
And yes, I am looking to move these items every time to the same folder
using an icon or keyboard shortcut. As for the macro - thanks for the key
piece - but I believe it takes a bit more code to complete the macro.
In every other Office app, I could simply record a function this simple and
be done - but NOT in Outlook. I am capable of hand writing my own VBA
routine, but as I don't routinely do this, it always takes me much longer
than necessary. I was hoping somebody out there had already invented this
wheel and would be willing to share.
"Eric Legault [MVP - Outlook]" wrote:
> If you are essentially just moving the message rather than deleting it, would
> using the File -> Move To Folder... command inside the message (or
> right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> folder view) be sufficient for your needs?
>
> If it is the same folder you are always moving the message to, you can use
> the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> message to a previously declared MAPIFolder variable.
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > I need a second message 'delete' button that doesn't truly delete a message
> > but moves it to a specified folder. Has anyone already written an Outlook
> > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > Outlook to jump start macro building is beyond me.)
> >
> > The reason is that I concurrently manage two on-line 'personalities' for
> > different employers and do not want the messages from one personality
> > auto-archived to the other personality's archive files.
> >
> > I can auto-segregate incoming messages by email account, I can
> > auto-segregate out-going messages by email account using the Rules Wizard -
> > but I cannot do this with deleted messages. (for legal reasons, I never
> > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Eric Legault [MVP - Outlo External

Since: Apr 22, 2004 Posts: 778
|
Posted: Fri Dec 10, 2004 11:33 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
What functionality remains to be added to make the macro complete for you?
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>
"Jim Johnson - Serenity Consulting" wrote:
> Well thanks, but that is only half the answer I was looking for.
>
> I know about the 'Move to Folder' option. It is what I am doing now and
> takes twice as much work as I am looking for because you have to both select
> the function, then select the destination.
>
> And yes, I am looking to move these items every time to the same folder
> using an icon or keyboard shortcut. As for the macro - thanks for the key
> piece - but I believe it takes a bit more code to complete the macro.
>
> In every other Office app, I could simply record a function this simple and
> be done - but NOT in Outlook. I am capable of hand writing my own VBA
> routine, but as I don't routinely do this, it always takes me much longer
> than necessary. I was hoping somebody out there had already invented this
> wheel and would be willing to share.
>
> "Eric Legault [MVP - Outlook]" wrote:
>
> > If you are essentially just moving the message rather than deleting it, would
> > using the File -> Move To Folder... command inside the message (or
> > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > folder view) be sufficient for your needs?
> >
> > If it is the same folder you are always moving the message to, you can use
> > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > message to a previously declared MAPIFolder variable.
> >
> > --
> > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > --------------------------------------------------
> > {Private e-mails ignored}
<font color=green> > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=green> > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> >
> > "Jim Johnson - Serenity Consulting" wrote:
> >
> > > I need a second message 'delete' button that doesn't truly delete a message
> > > but moves it to a specified folder. Has anyone already written an Outlook
> > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > Outlook to jump start macro building is beyond me.)
> > >
> > > The reason is that I concurrently manage two on-line 'personalities' for
> > > different employers and do not want the messages from one personality
> > > auto-archived to the other personality's archive files.
> > >
> > > I can auto-segregate incoming messages by email account, I can
> > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Fri Dec 10, 2004 12:33 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Not functionality - there is only one action. You missed the point. The goal
was to NOT reinvent a complete macro - just paste it all in. Your one line
may help me figure out which method is needed, but it sure as heck isn't a
complete macro.
Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
"Eric Legault [MVP - Outlook]" wrote:
> What functionality remains to be added to make the macro complete for you?
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Well thanks, but that is only half the answer I was looking for.
> >
> > I know about the 'Move to Folder' option. It is what I am doing now and
> > takes twice as much work as I am looking for because you have to both select
> > the function, then select the destination.
> >
> > And yes, I am looking to move these items every time to the same folder
> > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > piece - but I believe it takes a bit more code to complete the macro.
> >
> > In every other Office app, I could simply record a function this simple and
> > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > routine, but as I don't routinely do this, it always takes me much longer
> > than necessary. I was hoping somebody out there had already invented this
> > wheel and would be willing to share.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If you are essentially just moving the message rather than deleting it, would
> > > using the File -> Move To Folder... command inside the message (or
> > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > folder view) be sufficient for your needs?
> > >
> > > If it is the same folder you are always moving the message to, you can use
> > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > message to a previously declared MAPIFolder variable.
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
<font color=brown> > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > Outlook to jump start macro building is beyond me.)
> > > >
> > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > different employers and do not want the messages from one personality
> > > > auto-archived to the other personality's archive files.
> > > >
> > > > I can auto-segregate incoming messages by email account, I can
> > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Eric Legault [MVP - Outlo External

Since: Apr 22, 2004 Posts: 778
|
Posted: Fri Dec 10, 2004 1:23 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
If your goal was not to "reinvent" a macro but to have it automatically
created for you, then of course you are out of luck because there is no macro
recorder in Outlook. The only recourse we have is to hand-roll our own
solutions, which isn't terribly difficult with Outlook VBA, and that's where
this newsgroup comes in for assisting people who are having problems taming
the Outlook programming model beast.
I thought you had already begun the process of coding the solution, so I
gave you a quick pointer rather than write the code for you. Regardless,
below is the solution to your issue that I can share with you - it took all
of five minutes. It assumes the destination folder is under your Inbox, but
you can always tweak it for another location.
Sub MoveOpenedMessageToFolder()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
this is a mail folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveInspector Is Nothing Then
'Require that this procedure be called for an open item
Exit Sub
End If
If Application.ActiveInspector.CurrentItem.Class <> olMail Then
Exit Sub
End If
Application.ActiveInspector.CurrentItem.Move objFolder
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>
"Jim Johnson - Serenity Consulting" wrote:
> Not functionality - there is only one action. You missed the point. The goal
> was to NOT reinvent a complete macro - just paste it all in. Your one line
> may help me figure out which method is needed, but it sure as heck isn't a
> complete macro.
>
> Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
>
> "Eric Legault [MVP - Outlook]" wrote:
>
> > What functionality remains to be added to make the macro complete for you?
> >
> > --
> > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > --------------------------------------------------
> > {Private e-mails ignored}
<font color=green> > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=green> > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> >
> > "Jim Johnson - Serenity Consulting" wrote:
> >
> > > Well thanks, but that is only half the answer I was looking for.
> > >
> > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > takes twice as much work as I am looking for because you have to both select
> > > the function, then select the destination.
> > >
> > > And yes, I am looking to move these items every time to the same folder
> > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > piece - but I believe it takes a bit more code to complete the macro.
> > >
> > > In every other Office app, I could simply record a function this simple and
> > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > routine, but as I don't routinely do this, it always takes me much longer
> > > than necessary. I was hoping somebody out there had already invented this
> > > wheel and would be willing to share.
> > >
> > > "Eric Legault [MVP - Outlook]" wrote:
> > >
> > > > If you are essentially just moving the message rather than deleting it, would
> > > > using the File -> Move To Folder... command inside the message (or
> > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > folder view) be sufficient for your needs?
> > > >
> > > > If it is the same folder you are always moving the message to, you can use
> > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > message to a previously declared MAPIFolder variable.
> > > >
> > > > --
> > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > --------------------------------------------------
> > > > {Private e-mails ignored}
<font color=brown> > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > >
> > > > "Jim Johnson - Serenity Consulting" wrote:
> > > >
> > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > Outlook to jump start macro building is beyond me.)
> > > > >
> > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > different employers and do not want the messages from one personality
> > > > > auto-archived to the other personality's archive files.
> > > > >
> > > > > I can auto-segregate incoming messages by email account, I can
> > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook] External

Since: Feb 11, 2005 Posts: 21627
|
Posted: Fri Dec 10, 2004 1:56 pm Post subject: Re: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Not true. Most of today's growing number of Office applications do not have
macro recorders. The document-centric programs Word, Excel, and PowerPoint
are the exceptions, not the majority.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
<a style='text-decoration: underline;' href="http://www.outlookcode.com/jumpstart.aspx" target="_blank">http://www.outlookcode.com/jumpstart.aspx</a>
"Jim Johnson - Serenity Consulting"
<JimJohnsonSerenityConsulting.DeleteThis@discussions.microsoft.com> wrote in message
news:C04867CB-29EB-42AB-9199-07C86605577C@microsoft.com...
>
> In every other Office app, I could simply record a function this simple
> and
> be done - but NOT in Outlook. I am capable of hand writing my own VBA
> routine, but as I don't routinely do this, it always takes me much longer
> than necessary.<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Fri Dec 10, 2004 1:56 pm Post subject: Re: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
My apologies. I work mostly in Word, Excel and on occasion Access - all of
which build most of the macro code for you. For simple stuff, you at most
need to tweak a couple lines.
"Sue Mosher [MVP-Outlook]" wrote:
> Not true. Most of today's growing number of Office applications do not have
> macro recorders. The document-centric programs Word, Excel, and PowerPoint
> are the exceptions, not the majority.
>
> --
> Sue Mosher, Outlook MVP
> Author of
> Microsoft Outlook Programming - Jumpstart for
> Administrators, Power Users, and Developers
<font color=purple> > <a style='text-decoration: underline;' href="http://www.outlookcode.com/jumpstart.aspx</font" target="_blank">http://www.outlookcode.com/jumpstart.aspx</font</a>>
>
>
> "Jim Johnson - Serenity Consulting"
> <JimJohnsonSerenityConsulting.DeleteThis@discussions.microsoft.com> wrote in message
> news:C04867CB-29EB-42AB-9199-07C86605577C@microsoft.com...
> >
> > In every other Office app, I could simply record a function this simple
> > and
> > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > routine, but as I don't routinely do this, it always takes me much longer
> > than necessary.
>
>
><!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Fri Dec 10, 2004 2:37 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Thanks for your help Eric. Your macro doesn't quite do what I want - but it
is very close! I'll use it as a basis when I get around to dusting off my VBA
programming skills.
The destination folder is not under the Inbox, but co-equal in the folder
tree (a minor issue). The other is that I use the preview panel and only
fully open a message when absolutely necessary. I need to run the macro
against the selected message in the current mail folder.
Meanwhile I'll have to use the two step "Move to another folder" then select
the intended folder.
Thanks for trying.
"Eric Legault [MVP - Outlook]" wrote:
> If your goal was not to "reinvent" a macro but to have it automatically
> created for you, then of course you are out of luck because there is no macro
> recorder in Outlook. The only recourse we have is to hand-roll our own
> solutions, which isn't terribly difficult with Outlook VBA, and that's where
> this newsgroup comes in for assisting people who are having problems taming
> the Outlook programming model beast.
>
> I thought you had already begun the process of coding the solution, so I
> gave you a quick pointer rather than write the code for you. Regardless,
> below is the solution to your issue that I can share with you - it took all
> of five minutes. It assumes the destination folder is under your Inbox, but
> you can always tweak it for another location.
>
> Sub MoveOpenedMessageToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveInspector Is Nothing Then
> 'Require that this procedure be called for an open item
> Exit Sub
> End If
>
> If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> Exit Sub
> End If
>
> Application.ActiveInspector.CurrentItem.Move objFolder
>
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Not functionality - there is only one action. You missed the point. The goal
> > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > may help me figure out which method is needed, but it sure as heck isn't a
> > complete macro.
> >
> > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > What functionality remains to be added to make the macro complete for you?
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
<font color=brown> > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Well thanks, but that is only half the answer I was looking for.
> > > >
> > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > takes twice as much work as I am looking for because you have to both select
> > > > the function, then select the destination.
> > > >
> > > > And yes, I am looking to move these items every time to the same folder
> > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > piece - but I believe it takes a bit more code to complete the macro.
> > > >
> > > > In every other Office app, I could simply record a function this simple and
> > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > than necessary. I was hoping somebody out there had already invented this
> > > > wheel and would be willing to share.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > using the File -> Move To Folder... command inside the message (or
> > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > folder view) be sufficient for your needs?
> > > > >
> > > > > If it is the same folder you are always moving the message to, you can use
> > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > message to a previously declared MAPIFolder variable.
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
<font color=brown> > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > Outlook to jump start macro building is beyond me.)
> > > > > >
> > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > different employers and do not want the messages from one personality
> > > > > > auto-archived to the other personality's archive files.
> > > > > >
> > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook] External

Since: Feb 11, 2005 Posts: 21627
|
Posted: Fri Dec 10, 2004 3:34 pm Post subject: Re: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Well, there is virtually no "simple stuff" in Outlook, at least not until
you master the fundamental concepts.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
<a style='text-decoration: underline;' href="http://www.outlookcode.com/jumpstart.aspx" target="_blank">http://www.outlookcode.com/jumpstart.aspx</a>
"Jim Johnson - Serenity Consulting"
<JimJohnsonSerenityConsulting.TakeThisOut@discussions.microsoft.com> wrote in message
news:81117EFA-BD65-48EA-91FF-067AD031AF6E@microsoft.com...
> My apologies. I work mostly in Word, Excel and on occasion Access - all of
> which build most of the macro code for you. For simple stuff, you at most
> need to tweak a couple lines.
>
> "Sue Mosher [MVP-Outlook]" wrote:
>
>> Not true. Most of today's growing number of Office applications do not
>> have
>> macro recorders. The document-centric programs Word, Excel, and
>> PowerPoint
>> are the exceptions, not the majority.
>>
>> "Jim Johnson - Serenity Consulting"
>> <JimJohnsonSerenityConsulting.TakeThisOut@discussions.microsoft.com> wrote in message
>> news:C04867CB-29EB-42AB-9199-07C86605577C@microsoft.com...
>> >
>> > In every other Office app, I could simply record a function this simple
>> > and
>> > be done - but NOT in Outlook. I am capable of hand writing my own VBA
>> > routine, but as I don't routinely do this, it always takes me much
>> > longer
>> > than necessary.
>>
>>
>><!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Eric Legault [MVP - Outlo External

Since: Apr 22, 2004 Posts: 778
|
Posted: Fri Dec 10, 2004 11:47 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Okay, now that I know exactly what you want, I've altered the macro to handle
any selected messages in the current folder, and to look for the folder name
that you specify underneath the root of the same store containing your Inbox:
Sub MoveSelectedMessagesToFolder()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
'Assume this is a mail folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is selected
Exit Sub
End If
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
End If
End If
Next
Set objItem = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
--
Eric Legault - B.A, MCP, MCSD, Outlook MVP
--------------------------------------------------
{Private e-mails ignored}
Job: <a style='text-decoration: underline;' href="http://www.imaginets.com" target="_blank">http://www.imaginets.com</a>
Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/" target="_blank">http://blogs.officezealot.com/legault/</a>
"Jim Johnson - Serenity Consulting" wrote:
> Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> is very close! I'll use it as a basis when I get around to dusting off my VBA
> programming skills.
>
> The destination folder is not under the Inbox, but co-equal in the folder
> tree (a minor issue). The other is that I use the preview panel and only
> fully open a message when absolutely necessary. I need to run the macro
> against the selected message in the current mail folder.
>
> Meanwhile I'll have to use the two step "Move to another folder" then select
> the intended folder.
>
> Thanks for trying.
>
> "Eric Legault [MVP - Outlook]" wrote:
>
> > If your goal was not to "reinvent" a macro but to have it automatically
> > created for you, then of course you are out of luck because there is no macro
> > recorder in Outlook. The only recourse we have is to hand-roll our own
> > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > this newsgroup comes in for assisting people who are having problems taming
> > the Outlook programming model beast.
> >
> > I thought you had already begun the process of coding the solution, so I
> > gave you a quick pointer rather than write the code for you. Regardless,
> > below is the solution to your issue that I can share with you - it took all
> > of five minutes. It assumes the destination folder is under your Inbox, but
> > you can always tweak it for another location.
> >
> > Sub MoveOpenedMessageToFolder()
> > On Error Resume Next
> >
> > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > Dim objNS As Outlook.NameSpace
> >
> > Set objNS = Application.GetNamespace("MAPI")
> > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > this is a mail folder
> >
> > If objFolder Is Nothing Then
> > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > "INVALID FOLDER"
> > End If
> >
> > If Application.ActiveInspector Is Nothing Then
> > 'Require that this procedure be called for an open item
> > Exit Sub
> > End If
> >
> > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > Exit Sub
> > End If
> >
> > Application.ActiveInspector.CurrentItem.Move objFolder
> >
> > Set objFolder = Nothing
> > Set objInbox = Nothing
> > Set objNS = Nothing
> > End Sub
> >
> > --
> > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > --------------------------------------------------
> > {Private e-mails ignored}
<font color=green> > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=green> > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> >
> > "Jim Johnson - Serenity Consulting" wrote:
> >
> > > Not functionality - there is only one action. You missed the point. The goal
> > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > may help me figure out which method is needed, but it sure as heck isn't a
> > > complete macro.
> > >
> > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > >
> > > "Eric Legault [MVP - Outlook]" wrote:
> > >
> > > > What functionality remains to be added to make the macro complete for you?
> > > >
> > > > --
> > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > --------------------------------------------------
> > > > {Private e-mails ignored}
<font color=brown> > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > >
> > > > "Jim Johnson - Serenity Consulting" wrote:
> > > >
> > > > > Well thanks, but that is only half the answer I was looking for.
> > > > >
> > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > takes twice as much work as I am looking for because you have to both select
> > > > > the function, then select the destination.
> > > > >
> > > > > And yes, I am looking to move these items every time to the same folder
> > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > >
> > > > > In every other Office app, I could simply record a function this simple and
> > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > wheel and would be willing to share.
> > > > >
> > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > >
> > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > folder view) be sufficient for your needs?
> > > > > >
> > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > message to a previously declared MAPIFolder variable.
> > > > > >
> > > > > > --
> > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > --------------------------------------------------
> > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > >
> > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > >
> > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > >
> > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > different employers and do not want the messages from one personality
> > > > > > > auto-archived to the other personality's archive files.
> > > > > > >
> > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Mon Dec 13, 2004 8:01 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
PERFECT!!
I really didn't expect someone to craft a macro - I strongly suspect someone
has run into this issue before, and I was hoping they would share.
I built an appropriate icon and keyboard shortcut, now I'm all set.
Jim Johnson
"Eric Legault [MVP - Outlook]" wrote:
> Okay, now that I know exactly what you want, I've altered the macro to handle
> any selected messages in the current folder, and to look for the folder name
> that you specify underneath the root of the same store containing your Inbox:
>
> Sub MoveSelectedMessagesToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> 'Assume this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveExplorer.Selection.Count = 0 Then
> 'Require that this procedure be called only when a message is selected
> Exit Sub
> End If
>
> For Each objItem In Application.ActiveExplorer.Selection
> If objFolder.DefaultItemType = olMailItem Then
> If objItem.Class = olMail Then
> objItem.Move objFolder
> End If
> End If
> Next
>
> Set objItem = Nothing
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > programming skills.
> >
> > The destination folder is not under the Inbox, but co-equal in the folder
> > tree (a minor issue). The other is that I use the preview panel and only
> > fully open a message when absolutely necessary. I need to run the macro
> > against the selected message in the current mail folder.
> >
> > Meanwhile I'll have to use the two step "Move to another folder" then select
> > the intended folder.
> >
> > Thanks for trying.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If your goal was not to "reinvent" a macro but to have it automatically
> > > created for you, then of course you are out of luck because there is no macro
> > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > this newsgroup comes in for assisting people who are having problems taming
> > > the Outlook programming model beast.
> > >
> > > I thought you had already begun the process of coding the solution, so I
> > > gave you a quick pointer rather than write the code for you. Regardless,
> > > below is the solution to your issue that I can share with you - it took all
> > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > you can always tweak it for another location.
> > >
> > > Sub MoveOpenedMessageToFolder()
> > > On Error Resume Next
> > >
> > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > Dim objNS As Outlook.NameSpace
> > >
> > > Set objNS = Application.GetNamespace("MAPI")
> > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > this is a mail folder
> > >
> > > If objFolder Is Nothing Then
> > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > "INVALID FOLDER"
> > > End If
> > >
> > > If Application.ActiveInspector Is Nothing Then
> > > 'Require that this procedure be called for an open item
> > > Exit Sub
> > > End If
> > >
> > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > Exit Sub
> > > End If
> > >
> > > Application.ActiveInspector.CurrentItem.Move objFolder
> > >
> > > Set objFolder = Nothing
> > > Set objInbox = Nothing
> > > Set objNS = Nothing
> > > End Sub
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
<font color=brown> > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Not functionality - there is only one action. You missed the point. The goal
> > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > complete macro.
> > > >
> > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > What functionality remains to be added to make the macro complete for you?
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
<font color=brown> > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > >
> > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > the function, then select the destination.
> > > > > >
> > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > >
> > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > wheel and would be willing to share.
> > > > > >
> > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > >
> > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > folder view) be sufficient for your needs?
> > > > > > >
> > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > >
> > > > > > > --
> > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > --------------------------------------------------
> > > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > > >
> > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > >
> > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > >
> > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > >
> > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Jim Johnson - Serenity Co External

Since: Dec 10, 2004 Posts: 18
|
Posted: Wed Dec 15, 2004 9:43 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Hi Eric-
Your macro works very well as a button on the Outlook toobar. However, I did
need to make a very slight alteration to accomodate Read Receipts. Using the
properties function, I noted that Outlook doesn't view them as messages, but
reports. (in my business read receipts are a cheap CYA umbrella during
periodic blame storms) I then used the help function to track down this
object type.
I'm sure both objects could be handled within one loop structure with an
elseif, but as small as this macro is, down and dirty code using a copy and
paste works just as well.
Sub xDeleteMLS()
On Error Resume Next
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem, objReport
As Outlook.ReportItem
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Parent.Folders("Delete MLS") 'Assume this is a
mail folder
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveExplorer.Selection.Count = 0 Then
'Require that this procedure be called only when a message is selected
Exit Sub
End If
For Each objItem In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objItem.Move objFolder
End If
End If
Next
For Each objReport In Application.ActiveExplorer.Selection
If objFolder.DefaultItemType = olMailItem Then
If objItem.Class = olMail Then
objReport.Move objFolder
End If
End If
Next
Set objItem = Nothing
Set objReport = Nothing
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
'courtesty Eric Legault - B.A, MCP, MCSD, Outlook MVP
"Eric Legault [MVP - Outlook]" wrote:
> Okay, now that I know exactly what you want, I've altered the macro to handle
> any selected messages in the current folder, and to look for the folder name
> that you specify underneath the root of the same store containing your Inbox:
>
> Sub MoveSelectedMessagesToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> 'Assume this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveExplorer.Selection.Count = 0 Then
> 'Require that this procedure be called only when a message is selected
> Exit Sub
> End If
>
> For Each objItem In Application.ActiveExplorer.Selection
> If objFolder.DefaultItemType = olMailItem Then
> If objItem.Class = olMail Then
> objItem.Move objFolder
> End If
> End If
> Next
>
> Set objItem = Nothing
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > programming skills.
> >
> > The destination folder is not under the Inbox, but co-equal in the folder
> > tree (a minor issue). The other is that I use the preview panel and only
> > fully open a message when absolutely necessary. I need to run the macro
> > against the selected message in the current mail folder.
> >
> > Meanwhile I'll have to use the two step "Move to another folder" then select
> > the intended folder.
> >
> > Thanks for trying.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If your goal was not to "reinvent" a macro but to have it automatically
> > > created for you, then of course you are out of luck because there is no macro
> > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > this newsgroup comes in for assisting people who are having problems taming
> > > the Outlook programming model beast.
> > >
> > > I thought you had already begun the process of coding the solution, so I
> > > gave you a quick pointer rather than write the code for you. Regardless,
> > > below is the solution to your issue that I can share with you - it took all
> > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > you can always tweak it for another location.
> > >
> > > Sub MoveOpenedMessageToFolder()
> > > On Error Resume Next
> > >
> > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > Dim objNS As Outlook.NameSpace
> > >
> > > Set objNS = Application.GetNamespace("MAPI")
> > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > this is a mail folder
> > >
> > > If objFolder Is Nothing Then
> > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > "INVALID FOLDER"
> > > End If
> > >
> > > If Application.ActiveInspector Is Nothing Then
> > > 'Require that this procedure be called for an open item
> > > Exit Sub
> > > End If
> > >
> > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > Exit Sub
> > > End If
> > >
> > > Application.ActiveInspector.CurrentItem.Move objFolder
> > >
> > > Set objFolder = Nothing
> > > Set objInbox = Nothing
> > > Set objNS = Nothing
> > > End Sub
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
<font color=brown> > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Not functionality - there is only one action. You missed the point. The goal
> > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > complete macro.
> > > >
> > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > What functionality remains to be added to make the macro complete for you?
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
<font color=brown> > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > >
> > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > the function, then select the destination.
> > > > > >
> > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > >
> > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > wheel and would be willing to share.
> > > > > >
> > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > >
> > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > folder view) be sufficient for your needs?
> > > > > > >
> > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > >
> > > > > > > --
> > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > --------------------------------------------------
> > > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > > >
> > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > >
> > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > >
> > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > >
> > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Legal Learning External

Since: Aug 25, 2004 Posts: 15
|
Posted: Tue Jan 04, 2005 11:41 am Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Eric you are truly an Outlook VBA genius!
This macro is very close to what I need. Here is what this inept Outlook
VBA person needs (that's me!)
In the subject line of a message a number will exist that represents a
public folder name. For example the subject line of the email message might
be ABC company 123.001. I want the macro to find the number and move the
message into the corresponding public folder name.
"Jim Johnson - Serenity Consulting" wrote:
> PERFECT!!
>
> I really didn't expect someone to craft a macro - I strongly suspect someone
> has run into this issue before, and I was hoping they would share.
>
> I built an appropriate icon and keyboard shortcut, now I'm all set.
>
> Jim Johnson
>
>
> "Eric Legault [MVP - Outlook]" wrote:
>
> > Okay, now that I know exactly what you want, I've altered the macro to handle
> > any selected messages in the current folder, and to look for the folder name
> > that you specify underneath the root of the same store containing your Inbox:
> >
> > Sub MoveSelectedMessagesToFolder()
> > On Error Resume Next
> >
> > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
> >
> > Set objNS = Application.GetNamespace("MAPI")
> > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> > 'Assume this is a mail folder
> >
> > If objFolder Is Nothing Then
> > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > "INVALID FOLDER"
> > End If
> >
> > If Application.ActiveExplorer.Selection.Count = 0 Then
> > 'Require that this procedure be called only when a message is selected
> > Exit Sub
> > End If
> >
> > For Each objItem In Application.ActiveExplorer.Selection
> > If objFolder.DefaultItemType = olMailItem Then
> > If objItem.Class = olMail Then
> > objItem.Move objFolder
> > End If
> > End If
> > Next
> >
> > Set objItem = Nothing
> > Set objFolder = Nothing
> > Set objInbox = Nothing
> > Set objNS = Nothing
> > End Sub
> >
> > --
> > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > --------------------------------------------------
> > {Private e-mails ignored}
<font color=green> > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=green> > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> >
> >
> > "Jim Johnson - Serenity Consulting" wrote:
> >
> > > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > > programming skills.
> > >
> > > The destination folder is not under the Inbox, but co-equal in the folder
> > > tree (a minor issue). The other is that I use the preview panel and only
> > > fully open a message when absolutely necessary. I need to run the macro
> > > against the selected message in the current mail folder.
> > >
> > > Meanwhile I'll have to use the two step "Move to another folder" then select
> > > the intended folder.
> > >
> > > Thanks for trying.
> > >
> > > "Eric Legault [MVP - Outlook]" wrote:
> > >
> > > > If your goal was not to "reinvent" a macro but to have it automatically
> > > > created for you, then of course you are out of luck because there is no macro
> > > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > > this newsgroup comes in for assisting people who are having problems taming
> > > > the Outlook programming model beast.
> > > >
> > > > I thought you had already begun the process of coding the solution, so I
> > > > gave you a quick pointer rather than write the code for you. Regardless,
> > > > below is the solution to your issue that I can share with you - it took all
> > > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > > you can always tweak it for another location.
> > > >
> > > > Sub MoveOpenedMessageToFolder()
> > > > On Error Resume Next
> > > >
> > > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > > Dim objNS As Outlook.NameSpace
> > > >
> > > > Set objNS = Application.GetNamespace("MAPI")
> > > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > > this is a mail folder
> > > >
> > > > If objFolder Is Nothing Then
> > > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > > "INVALID FOLDER"
> > > > End If
> > > >
> > > > If Application.ActiveInspector Is Nothing Then
> > > > 'Require that this procedure be called for an open item
> > > > Exit Sub
> > > > End If
> > > >
> > > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > > Exit Sub
> > > > End If
> > > >
> > > > Application.ActiveInspector.CurrentItem.Move objFolder
> > > >
> > > > Set objFolder = Nothing
> > > > Set objInbox = Nothing
> > > > Set objNS = Nothing
> > > > End Sub
> > > >
> > > > --
> > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > --------------------------------------------------
> > > > {Private e-mails ignored}
<font color=brown> > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > >
> > > > "Jim Johnson - Serenity Consulting" wrote:
> > > >
> > > > > Not functionality - there is only one action. You missed the point. The goal
> > > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > > complete macro.
> > > > >
> > > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > > >
> > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > >
> > > > > > What functionality remains to be added to make the macro complete for you?
> > > > > >
> > > > > > --
> > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > --------------------------------------------------
> > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > >
> > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > >
> > > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > > >
> > > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > > the function, then select the destination.
> > > > > > >
> > > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > > >
> > > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > > wheel and would be willing to share.
> > > > > > >
> > > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > > >
> > > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > > folder view) be sufficient for your needs?
> > > > > > > >
> > > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > > >
> > > > > > > > --
> > > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > > --------------------------------------------------
> > > > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > > > >
> > > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > > >
> > > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > > >
> > > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > > >
> > > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Gus Darino External

Since: Jan 31, 2005 Posts: 1
|
Posted: Mon Jan 31, 2005 2:59 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Can you provide a variation of this macro that will move the emails to a
folder on a "personal folder" (PST) file instead?
Auto Archive lets me do this on a scheduled basis but I need to be able
to move emails manually. The solution you provided gets me there with
the adjustment above.
Thank you
GusDarino
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! |
|
| Back to top |
|
 |
Sue Mosher [MVP-Outlook] External

Since: Feb 11, 2005 Posts: 21627
|
Posted: Mon Jan 31, 2005 6:35 pm Post subject: Re: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
What solution? The newsgroup interface you are using apparently does not
quote earlier messages in the thread, making your latest message way too
short on detail. Please take the time to quote the original message.
--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
<a style='text-decoration: underline;' href="http://www.outlookcode.com/jumpstart.aspx" target="_blank">http://www.outlookcode.com/jumpstart.aspx</a>
"Gus Darino" <darino.TakeThisOut@earthlink.net> wrote in message
news:u4eGuA%23BFHA.2600@TK2MSFTNGP09.phx.gbl...
> Can you provide a variation of this macro that will move the emails to a
> folder on a "personal folder" (PST) file instead?
>
> Auto Archive lets me do this on a scheduled basis but I need to be able
> to move emails manually. The solution you provided gets me there with
> the adjustment above.
>
> Thank you
>
> GusDarino
>
>
>
> *** Sent via Developersdex <a style='text-decoration: underline;' href="http://www.developersdex.com" target="_blank">http://www.developersdex.com</a> ***
> Don't just participate in USENET...get rewarded for it!<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
chris w External

Since: Jan 13, 2005 Posts: 9
|
Posted: Wed Feb 02, 2005 2:45 pm Post subject: RE: create a macro to move outlook 2003 message to a specifi [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
This is perfect, I was just trying to make this today. I blended your first
and altered code to do exactly what I wanted.
I havent done any code or macro in Outlook so excuse the ignorance. It is
saved now in -VbaProject.OTM - ThisOutlookSession (Code)
Is this where I want it?
Will it be available everytime I open outlook in its current location?
Thank you,
Chris
"Eric Legault [MVP - Outlook]" wrote:
> Okay, now that I know exactly what you want, I've altered the macro to handle
> any selected messages in the current folder, and to look for the folder name
> that you specify underneath the root of the same store containing your Inbox:
>
> Sub MoveSelectedMessagesToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> 'Assume this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveExplorer.Selection.Count = 0 Then
> 'Require that this procedure be called only when a message is selected
> Exit Sub
> End If
>
> For Each objItem In Application.ActiveExplorer.Selection
> If objFolder.DefaultItemType = olMailItem Then
> If objItem.Class = olMail Then
> objItem.Move objFolder
> End If
> End If
> Next
>
> Set objItem = Nothing
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
<font color=purple> > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=purple> > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > programming skills.
> >
> > The destination folder is not under the Inbox, but co-equal in the folder
> > tree (a minor issue). The other is that I use the preview panel and only
> > fully open a message when absolutely necessary. I need to run the macro
> > against the selected message in the current mail folder.
> >
> > Meanwhile I'll have to use the two step "Move to another folder" then select
> > the intended folder.
> >
> > Thanks for trying.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If your goal was not to "reinvent" a macro but to have it automatically
> > > created for you, then of course you are out of luck because there is no macro
> > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > this newsgroup comes in for assisting people who are having problems taming
> > > the Outlook programming model beast.
> > >
> > > I thought you had already begun the process of coding the solution, so I
> > > gave you a quick pointer rather than write the code for you. Regardless,
> > > below is the solution to your issue that I can share with you - it took all
> > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > you can always tweak it for another location.
> > >
> > > Sub MoveOpenedMessageToFolder()
> > > On Error Resume Next
> > >
> > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > Dim objNS As Outlook.NameSpace
> > >
> > > Set objNS = Application.GetNamespace("MAPI")
> > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > this is a mail folder
> > >
> > > If objFolder Is Nothing Then
> > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > "INVALID FOLDER"
> > > End If
> > >
> > > If Application.ActiveInspector Is Nothing Then
> > > 'Require that this procedure be called for an open item
> > > Exit Sub
> > > End If
> > >
> > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > Exit Sub
> > > End If
> > >
> > > Application.ActiveInspector.CurrentItem.Move objFolder
> > >
> > > Set objFolder = Nothing
> > > Set objInbox = Nothing
> > > Set objNS = Nothing
> > > End Sub
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
<font color=brown> > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Not functionality - there is only one action. You missed the point. The goal
> > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > complete macro.
> > > >
> > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > What functionality remains to be added to make the macro complete for you?
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
<font color=brown> > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > >
> > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > the function, then select the destination.
> > > > > >
> > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > >
> > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > wheel and would be willing to share.
> > > > > >
> > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > >
> > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > folder view) be sufficient for your needs?
> > > > > > >
> > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > >
> > > > > > > --
> > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > --------------------------------------------------
> > > > > > > {Private e-mails ignored}
<font color=brown> > > > > > > > Job: <a style='text-decoration: underline;' href="http://www.imaginets.com</font" target="_blank">http://www.imaginets.com</font</a>>
<font color=brown> > > > > > > > Blog: <a style='text-decoration: underline;' href="http://blogs.officezealot.com/legault/</font" target="_blank">http://blogs.officezealot.com/legault/</font</a>>
> > > > > > >
> > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > >
> > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > >
> > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > >
> > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > actually delete anything).<!-- ~MESSAGE_AFTER~ --> |
|
| Back to top |
|
 |
Robin External

Since: Jun 20, 2006 Posts: 76
|
Posted: Fri May 04, 2007 3:09 am Post subject: RE: create a macro to move outlook 2003 message to a specific fold [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Hey Eric
I had a look at this post and I have modified the code to move an email that
I am sending into a temporary folder if I dont think that I will need. It
works fine on a new email but for forwarded mails (go figure!) gives an error
message "The Send operation failed because the item was deleted before it was
sent". It does send the mail to the "TEMP SENT" folder though. Any ideas what
is causing this? My code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim answer As Long
Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
If Item.Class = olMail Then
answer = MsgBox("SAVE subj: " & Item.Subject & " to Sent Items?", vbYesNo)
If answer = vbNo Then
On Error Resume Next
Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders("TEMP SENT")
If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
"INVALID FOLDER"
End If
If Application.ActiveInspector Is Nothing Then
'Require that this procedure be called for an open item
Exit Sub
End If
If Application.ActiveInspector.CurrentItem.Class <> olMail Then
Exit Sub
End If
Application.ActiveInspector.CurrentItem.Move objFolder
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End If
End If
End Sub
"Gus Darino" wrote:
> Can you provide a variation of this macro that will move the emails to a
> folder on a "personal folder" (PST) file instead?
>
> Auto Archive lets me do this on a scheduled basis but I need to be able
> to move emails manually. The solution you provided gets me there with
> the adjustment above.
>
> Thank you
>
> GusDarino
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
> |
|
| Back to top |
|
 |
alexcraig External

Since: Dec 17, 2006 Posts: 5
|
Posted: Sun Jul 01, 2007 12:46 pm Post subject: RE: create a macro to move outlook 2003 message to a specific fold [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
Eric,
And here we have more living proof that archiving older posts can certainly
be helpful.
This is exactly what I needed, as well ...... 4 years later.
Works like a charm in Office 2007.
Thanks! You just saved me some coding legwork.
Alex Craig
"Eric Legault [MVP - Outlook]" wrote:
> Okay, now that I know exactly what you want, I've altered the macro to handle
> any selected messages in the current folder, and to look for the folder name
> that you specify underneath the root of the same store containing your Inbox:
>
> Sub MoveSelectedMessagesToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> 'Assume this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveExplorer.Selection.Count = 0 Then
> 'Require that this procedure be called only when a message is selected
> Exit Sub
> End If
>
> For Each objItem In Application.ActiveExplorer.Selection
> If objFolder.DefaultItemType = olMailItem Then
> If objItem.Class = olMail Then
> objItem.Move objFolder
> End If
> End If
> Next
>
> Set objItem = Nothing
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
> Job: http://www.imaginets.com
> Blog: http://blogs.officezealot.com/legault/
>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > programming skills.
> >
> > The destination folder is not under the Inbox, but co-equal in the folder
> > tree (a minor issue). The other is that I use the preview panel and only
> > fully open a message when absolutely necessary. I need to run the macro
> > against the selected message in the current mail folder.
> >
> > Meanwhile I'll have to use the two step "Move to another folder" then select
> > the intended folder.
> >
> > Thanks for trying.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If your goal was not to "reinvent" a macro but to have it automatically
> > > created for you, then of course you are out of luck because there is no macro
> > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > this newsgroup comes in for assisting people who are having problems taming
> > > the Outlook programming model beast.
> > >
> > > I thought you had already begun the process of coding the solution, so I
> > > gave you a quick pointer rather than write the code for you. Regardless,
> > > below is the solution to your issue that I can share with you - it took all
> > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > you can always tweak it for another location.
> > >
> > > Sub MoveOpenedMessageToFolder()
> > > On Error Resume Next
> > >
> > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > Dim objNS As Outlook.NameSpace
> > >
> > > Set objNS = Application.GetNamespace("MAPI")
> > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > this is a mail folder
> > >
> > > If objFolder Is Nothing Then
> > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > "INVALID FOLDER"
> > > End If
> > >
> > > If Application.ActiveInspector Is Nothing Then
> > > 'Require that this procedure be called for an open item
> > > Exit Sub
> > > End If
> > >
> > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > Exit Sub
> > > End If
> > >
> > > Application.ActiveInspector.CurrentItem.Move objFolder
> > >
> > > Set objFolder = Nothing
> > > Set objInbox = Nothing
> > > Set objNS = Nothing
> > > End Sub
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
> > > Job: http://www.imaginets.com
> > > Blog: http://blogs.officezealot.com/legault/
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Not functionality - there is only one action. You missed the point. The goal
> > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > complete macro.
> > > >
> > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > What functionality remains to be added to make the macro complete for you?
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
> > > > > Job: http://www.imaginets.com
> > > > > Blog: http://blogs.officezealot.com/legault/
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > >
> > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > the function, then select the destination.
> > > > > >
> > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > >
> > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > wheel and would be willing to share.
> > > > > >
> > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > >
> > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > folder view) be sufficient for your needs?
> > > > > > >
> > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > >
> > > > > > > --
> > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > --------------------------------------------------
> > > > > > > {Private e-mails ignored}
> > > > > > > Job: http://www.imaginets.com
> > > > > > > Blog: http://blogs.officezealot.com/legault/
> > > > > > >
> > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > >
> > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > >
> > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > >
> > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > actually delete anything). |
|
| Back to top |
|
 |
EddieS External

Since: Apr 22, 2009 Posts: 1
|
Posted: Wed Apr 22, 2009 9:23 pm Post subject: RE: create a macro to move outlook 2003 message to a specific fold [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
This code is fantastic...thank you.
I was wondering though .. is it possible to get this to run on closing the
current open email.
That is .. move the email to a folder on closing it.
I haven't had any luck with getting this to work.
Regards,
Eddie
"Eric Legault [MVP - Outlook]" wrote:
> Okay, now that I know exactly what you want, I've altered the macro to handle
> any selected messages in the current folder, and to look for the folder name
> that you specify underneath the root of the same store containing your Inbox:
>
> Sub MoveSelectedMessagesToFolder()
> On Error Resume Next
>
> Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> Dim objNS As Outlook.NameSpace, objItem As Outlook.MailItem
>
> Set objNS = Application.GetNamespace("MAPI")
> Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> Set objFolder = objInbox.Parent.Folders("Some Folder Under The Root")
> 'Assume this is a mail folder
>
> If objFolder Is Nothing Then
> MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> "INVALID FOLDER"
> End If
>
> If Application.ActiveExplorer.Selection.Count = 0 Then
> 'Require that this procedure be called only when a message is selected
> Exit Sub
> End If
>
> For Each objItem In Application.ActiveExplorer.Selection
> If objFolder.DefaultItemType = olMailItem Then
> If objItem.Class = olMail Then
> objItem.Move objFolder
> End If
> End If
> Next
>
> Set objItem = Nothing
> Set objFolder = Nothing
> Set objInbox = Nothing
> Set objNS = Nothing
> End Sub
>
> --
> Eric Legault - B.A, MCP, MCSD, Outlook MVP
> --------------------------------------------------
> {Private e-mails ignored}
> Job: http://www.imaginets.com
> Blog: http://blogs.officezealot.com/legault/
>
>
> "Jim Johnson - Serenity Consulting" wrote:
>
> > Thanks for your help Eric. Your macro doesn't quite do what I want - but it
> > is very close! I'll use it as a basis when I get around to dusting off my VBA
> > programming skills.
> >
> > The destination folder is not under the Inbox, but co-equal in the folder
> > tree (a minor issue). The other is that I use the preview panel and only
> > fully open a message when absolutely necessary. I need to run the macro
> > against the selected message in the current mail folder.
> >
> > Meanwhile I'll have to use the two step "Move to another folder" then select
> > the intended folder.
> >
> > Thanks for trying.
> >
> > "Eric Legault [MVP - Outlook]" wrote:
> >
> > > If your goal was not to "reinvent" a macro but to have it automatically
> > > created for you, then of course you are out of luck because there is no macro
> > > recorder in Outlook. The only recourse we have is to hand-roll our own
> > > solutions, which isn't terribly difficult with Outlook VBA, and that's where
> > > this newsgroup comes in for assisting people who are having problems taming
> > > the Outlook programming model beast.
> > >
> > > I thought you had already begun the process of coding the solution, so I
> > > gave you a quick pointer rather than write the code for you. Regardless,
> > > below is the solution to your issue that I can share with you - it took all
> > > of five minutes. It assumes the destination folder is under your Inbox, but
> > > you can always tweak it for another location.
> > >
> > > Sub MoveOpenedMessageToFolder()
> > > On Error Resume Next
> > >
> > > Dim objFolder As Outlook.MAPIFolder, objInbox As Outlook.MAPIFolder
> > > Dim objNS As Outlook.NameSpace
> > >
> > > Set objNS = Application.GetNamespace("MAPI")
> > > Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
> > > Set objFolder = objInbox.Folders("Some Folder Under The Inbox") 'Assume
> > > this is a mail folder
> > >
> > > If objFolder Is Nothing Then
> > > MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation,
> > > "INVALID FOLDER"
> > > End If
> > >
> > > If Application.ActiveInspector Is Nothing Then
> > > 'Require that this procedure be called for an open item
> > > Exit Sub
> > > End If
> > >
> > > If Application.ActiveInspector.CurrentItem.Class <> olMail Then
> > > Exit Sub
> > > End If
> > >
> > > Application.ActiveInspector.CurrentItem.Move objFolder
> > >
> > > Set objFolder = Nothing
> > > Set objInbox = Nothing
> > > Set objNS = Nothing
> > > End Sub
> > >
> > > --
> > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > --------------------------------------------------
> > > {Private e-mails ignored}
> > > Job: http://www.imaginets.com
> > > Blog: http://blogs.officezealot.com/legault/
> > >
> > > "Jim Johnson - Serenity Consulting" wrote:
> > >
> > > > Not functionality - there is only one action. You missed the point. The goal
> > > > was to NOT reinvent a complete macro - just paste it all in. Your one line
> > > > may help me figure out which method is needed, but it sure as heck isn't a
> > > > complete macro.
> > > >
> > > > Oh well, thanks anyhow - when I have some extra time I'll re-teach myself VBA.
> > > >
> > > > "Eric Legault [MVP - Outlook]" wrote:
> > > >
> > > > > What functionality remains to be added to make the macro complete for you?
> > > > >
> > > > > --
> > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > --------------------------------------------------
> > > > > {Private e-mails ignored}
> > > > > Job: http://www.imaginets.com
> > > > > Blog: http://blogs.officezealot.com/legault/
> > > > >
> > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > >
> > > > > > Well thanks, but that is only half the answer I was looking for.
> > > > > >
> > > > > > I know about the 'Move to Folder' option. It is what I am doing now and
> > > > > > takes twice as much work as I am looking for because you have to both select
> > > > > > the function, then select the destination.
> > > > > >
> > > > > > And yes, I am looking to move these items every time to the same folder
> > > > > > using an icon or keyboard shortcut. As for the macro - thanks for the key
> > > > > > piece - but I believe it takes a bit more code to complete the macro.
> > > > > >
> > > > > > In every other Office app, I could simply record a function this simple and
> > > > > > be done - but NOT in Outlook. I am capable of hand writing my own VBA
> > > > > > routine, but as I don't routinely do this, it always takes me much longer
> > > > > > than necessary. I was hoping somebody out there had already invented this
> > > > > > wheel and would be willing to share.
> > > > > >
> > > > > > "Eric Legault [MVP - Outlook]" wrote:
> > > > > >
> > > > > > > If you are essentially just moving the message rather than deleting it, would
> > > > > > > using the File -> Move To Folder... command inside the message (or
> > > > > > > right-click the message, Move To Folder... / Edit -> Move To Folder... in the
> > > > > > > folder view) be sufficient for your needs?
> > > > > > >
> > > > > > > If it is the same folder you are always moving the message to, you can use
> > > > > > > the Item.Move(DestinationFolder As MAPIFolder Object) method to move the
> > > > > > > message to a previously declared MAPIFolder variable.
> > > > > > >
> > > > > > > --
> > > > > > > Eric Legault - B.A, MCP, MCSD, Outlook MVP
> > > > > > > --------------------------------------------------
> > > > > > > {Private e-mails ignored}
> > > > > > > Job: http://www.imaginets.com
> > > > > > > Blog: http://blogs.officezealot.com/legault/
> > > > > > >
> > > > > > > "Jim Johnson - Serenity Consulting" wrote:
> > > > > > >
> > > > > > > > I need a second message 'delete' button that doesn't truly delete a message
> > > > > > > > but moves it to a specified folder. Has anyone already written an Outlook
> > > > > > > > 2003 macro to do this? (Why Microsoft refuses to put a 'learn' function into
> > > > > > > > Outlook to jump start macro building is beyond me.)
> > > > > > > >
> > > > > > > > The reason is that I concurrently manage two on-line 'personalities' for
> > > > > > > > different employers and do not want the messages from one personality
> > > > > > > > auto-archived to the other personality's archive files.
> > > > > > > >
> > > > > > > > I can auto-segregate incoming messages by email account, I can
> > > > > > > > auto-segregate out-going messages by email account using the Rules Wizard -
> > > > > > > > but I cannot do this with deleted messages. (for legal reasons, I never
> > > > > > > > actually delete anything). |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|