S
Shay
Hi I need to create a macro to move selected email to an inbox subfolder.
Please forgive me as I am an admin and not a programmer. I found the below
macro on the internet but when I run it I get Runtime error 424 Object
Required.
TIA,
Shay
=======================================
Public Sub mocetosave()
Set myNameSpace = Application.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(6)
Set myitems = myInbox.Items
Set myDestFolder = myInbox.Folders("Saved Mail")
Set myitem = GetCurrentItem()
myitem.MoveTo myDestFolder
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function
Please forgive me as I am an admin and not a programmer. I found the below
macro on the internet but when I run it I get Runtime error 424 Object
Required.
TIA,
Shay
=======================================
Public Sub mocetosave()
Set myNameSpace = Application.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(6)
Set myitems = myInbox.Items
Set myDestFolder = myInbox.Folders("Saved Mail")
Set myitem = GetCurrentItem()
myitem.MoveTo myDestFolder
End Sub
Function GetCurrentItem() As Object
Dim objApp As Outlook.Application
Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
' anything else will result in an error, which is
' why we have the error handler above
End Select
Set objApp = Nothing
End Function