![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
What I've done is uninstall the David Allen "Getting Things Done" Add-In,
because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
Ads |
#2
|
|||
|
|||
![]() If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#3
|
|||
|
|||
![]()
Is there a smarter way? Would changing MessageClass be *in addition* to
everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#4
|
|||
|
|||
![]() In addition to what? So far, your code does nothign to turn the items to TaskItems. If you want to keep the e-mails and want them additionally as tasks then you have to create new TaskItems with the CreateItem function, and then copy every property to it. If you don't need the e-mail anymore and want to have them displayed as TaskItems then simply change the MessageClass property. By that property Outlok decides what form to use. Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Come on, that a user has to do one click to perform an action tells that the code behind the scenes might be very smart, not that it's simple to write. But you can relax, when you have finished the code you're still years away from having learned the entirely progamming language. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 1 Oct 2007 16:56:02 -0700 schrieb NHedley: Is there a smarter way? Would changing MessageClass be *in addition* to everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#5
|
|||
|
|||
![]()
As I stared blankly at the screen, trying to figure out how to change the
message property, I found this: http://blogs.techrepublic.com.com/msoffice/?p=281 Which apparently does almost exactly what I want. Almost. If I could replicate this result without all the mouse traffic, and without having to delete the original email I'd be a happy camper. But I think in the long run, the amount of time I'll spend trying to learn how to write and refine the code is about the same as the amount of time I'll spend dragging and hitting the "delete" key. Thanks for trying to help a n00b out. Best, Neil "Michael Bauer [MVP - Outlook]" wrote: In addition to what? So far, your code does nothign to turn the items to TaskItems. If you want to keep the e-mails and want them additionally as tasks then you have to create new TaskItems with the CreateItem function, and then copy every property to it. If you don't need the e-mail anymore and want to have them displayed as TaskItems then simply change the MessageClass property. By that property Outlok decides what form to use. Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Come on, that a user has to do one click to perform an action tells that the code behind the scenes might be very smart, not that it's simple to write. But you can relax, when you have finished the code you're still years away from having learned the entirely progamming language. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 1 Oct 2007 16:56:02 -0700 schrieb NHedley: Is there a smarter way? Would changing MessageClass be *in addition* to everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#6
|
|||
|
|||
![]()
The problem with the drag-and-drop method is that it doesn't copy any attachments.
You might also want to check out this code sample: http://outlookcode.com/codedetail.aspx?id=959 -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "NHedley" wrote in message ... As I stared blankly at the screen, trying to figure out how to change the message property, I found this: http://blogs.techrepublic.com.com/msoffice/?p=281 Which apparently does almost exactly what I want. Almost. If I could replicate this result without all the mouse traffic, and without having to delete the original email I'd be a happy camper. But I think in the long run, the amount of time I'll spend trying to learn how to write and refine the code is about the same as the amount of time I'll spend dragging and hitting the "delete" key. Thanks for trying to help a n00b out. Best, Neil "Michael Bauer [MVP - Outlook]" wrote: In addition to what? So far, your code does nothign to turn the items to TaskItems. If you want to keep the e-mails and want them additionally as tasks then you have to create new TaskItems with the CreateItem function, and then copy every property to it. If you don't need the e-mail anymore and want to have them displayed as TaskItems then simply change the MessageClass property. By that property Outlok decides what form to use. Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Come on, that a user has to do one click to perform an action tells that the code behind the scenes might be very smart, not that it's simple to write. But you can relax, when you have finished the code you're still years away from having learned the entirely progamming language. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 1 Oct 2007 16:56:02 -0700 schrieb NHedley: Is there a smarter way? Would changing MessageClass be *in addition* to everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#7
|
|||
|
|||
![]()
Thanks, Sue - wow! Is there ANYTHING that ISN'T on your website?
Thanks for the code - this doesn't delete the original email, does it? Is there an easy way a complete moron like me could modify it to blow out the email and keep the task intact, or is that a whole different thing? --Neil "Sue Mosher [MVP-Outlook]" wrote: The problem with the drag-and-drop method is that it doesn't copy any attachments. You might also want to check out this code sample: http://outlookcode.com/codedetail.aspx?id=959 -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "NHedley" wrote in message ... As I stared blankly at the screen, trying to figure out how to change the message property, I found this: http://blogs.techrepublic.com.com/msoffice/?p=281 Which apparently does almost exactly what I want. Almost. If I could replicate this result without all the mouse traffic, and without having to delete the original email I'd be a happy camper. But I think in the long run, the amount of time I'll spend trying to learn how to write and refine the code is about the same as the amount of time I'll spend dragging and hitting the "delete" key. Thanks for trying to help a n00b out. Best, Neil "Michael Bauer [MVP - Outlook]" wrote: In addition to what? So far, your code does nothign to turn the items to TaskItems. If you want to keep the e-mails and want them additionally as tasks then you have to create new TaskItems with the CreateItem function, and then copy every property to it. If you don't need the e-mail anymore and want to have them displayed as TaskItems then simply change the MessageClass property. By that property Outlok decides what form to use. Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Come on, that a user has to do one click to perform an action tells that the code behind the scenes might be very smart, not that it's simple to write. But you can relax, when you have finished the code you're still years away from having learned the entirely progamming language. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 1 Oct 2007 16:56:02 -0700 schrieb NHedley: Is there a smarter way? Would changing MessageClass be *in addition* to everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
#8
|
|||
|
|||
![]()
No, it doesn't, but since it does return an object variable reference to the message, all you have to do is add a code statement that calls that object's Delete method.
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "NHedley" wrote in message ... Thanks, Sue - wow! Is there ANYTHING that ISN'T on your website? Thanks for the code - this doesn't delete the original email, does it? Is there an easy way a complete moron like me could modify it to blow out the email and keep the task intact, or is that a whole different thing? --Neil "Sue Mosher [MVP-Outlook]" wrote: The problem with the drag-and-drop method is that it doesn't copy any attachments. You might also want to check out this code sample: http://outlookcode.com/codedetail.aspx?id=959 "NHedley" wrote in message ... As I stared blankly at the screen, trying to figure out how to change the message property, I found this: http://blogs.techrepublic.com.com/msoffice/?p=281 Which apparently does almost exactly what I want. Almost. If I could replicate this result without all the mouse traffic, and without having to delete the original email I'd be a happy camper. But I think in the long run, the amount of time I'll spend trying to learn how to write and refine the code is about the same as the amount of time I'll spend dragging and hitting the "delete" key. Thanks for trying to help a n00b out. Best, Neil "Michael Bauer [MVP - Outlook]" wrote: In addition to what? So far, your code does nothign to turn the items to TaskItems. If you want to keep the e-mails and want them additionally as tasks then you have to create new TaskItems with the CreateItem function, and then copy every property to it. If you don't need the e-mail anymore and want to have them displayed as TaskItems then simply change the MessageClass property. By that property Outlok decides what form to use. Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Come on, that a user has to do one click to perform an action tells that the code behind the scenes might be very smart, not that it's simple to write. But you can relax, when you have finished the code you're still years away from having learned the entirely progamming language. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Mon, 1 Oct 2007 16:56:02 -0700 schrieb NHedley: Is there a smarter way? Would changing MessageClass be *in addition* to everything else? Or simply *instead of*? Sorry - this is all very new to me. I want to accomplish one simple thing, and I'm finding myself having to learn an entire programming language to essentially run a three-click macro. Thanks. "Michael Bauer [MVP - Outlook]" wrote: If you want to turn the e-mail into a task without creating a nw item then change its MessageClass property to 'IPM.Task'. BTW: Your MoveMessages method doesn't work if you really have more than one item selected. Then you'd have to loop backwards. -- Viele Gruesse / Best regards Michael Bauer - MVP Outlook Organize eMails: http://www.vboffice.net/product.html?id=2006063&cmd=detail&lang=en&pub=6 Am Sun, 30 Sep 2007 17:33:00 -0700 schrieb NHedley: What I've done is uninstall the David Allen "Getting Things Done" Add-In, because it doesn't play nice with the Project Web Access Add-In. So here's the main functionality from GTD I'm trying to replace...I'd like to be able to take a message from any folder (mostly my Inbox), and with one click on the toolbar, mark it as read, convert it to a task, and open the resulting task form so I can edit categories, dates and such. Here's what I have so far (borrowed and stolen from around the 'net), and it works like a charm. Obviously, it doesn't open the task form, because everything I've tried opens the original email, not the task. snip Sub MoveMessages(strFolder As String) Dim olkItem As Object, _ olkFolder As Outlook.MAPIFolder Set olkFolder = OpenMAPIFolder(strFolder) If TypeName(olkFolder) = "MAPIFolder" Then For Each olkItem In Application.ActiveExplorer.Selection olkItem.UnRead = False olkItem.Save olkItem.Move olkFolder Next End If Set olkFolder = Nothing Set olkItem = Nothing End Sub Sub CreateTask() MoveMessages "\Personal Folders\Tasks" End Sub Function OpenMAPIFolder(szPath) Dim app, ns, flr, szDir, i Set flr = Nothing Set app = CreateObject("Outlook.Application") If Left(szPath, Len("\")) = "\" Then szPath = Mid(szPath, Len("\") + 1) Else Set flr = app.ActiveExplorer.CurrentFolder End If While szPath "" i = InStr(szPath, "\") If i Then szDir = Left(szPath, i - 1) szPath = Mid(szPath, i + Len("\")) Else szDir = szPath szPath = "" End If If IsNothing(flr) Then Set ns = app.GetNamespace("MAPI") Set flr = ns.Folders(szDir) Else Set flr = flr.Folders(szDir) End If Wend Set OpenMAPIFolder = flr End Function Function IsNothing(obj) If TypeName(obj) = "Nothing" Then IsNothing = True Else IsNothing = False End If End Function /snip Anyone? Bueller? The above move multiple messages at a time; that functionality isn't critical to me, as I tend to process everything as it arrives; but someone else might have a need to move a large number of items all at once. Thanks in advance for any advice. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
how do I change a calendar appointment to a task? | jc | Outlook - Calandaring | 1 | July 24th 07 05:31 PM |
How do I change task ownership? | Jake | Outlook - Installation | 0 | June 10th 07 08:06 PM |
change task due dates default | jaelde | Outlook - Calandaring | 1 | July 11th 06 10:45 AM |
How to change the Task Default Window..... | Christi | Outlook - General Queries | 1 | June 19th 06 08:47 PM |
Task bar refresh with calendar change | fetch98 | Outlook - Calandaring | 0 | January 19th 06 09:59 PM |