D
Dean
Hello,
I want to automate the task of moving the currently open Outlook message into
a folder called "TEMP" I found a code example on this forum but have a few
questions. My variation of the code pasted below.
1) How do I dimension those object variables (note ????? in the code)?
2) Does the code look right?
Thanks in advance for any help you can provide.
Best Regards,
Dean
'---------------------------------------------------------------------------
Public Sub moveMsgToTEMP()
On Error GoTo Err_moveMsgToTEMP
'this sub moves the currently open message to the TEMP folder
Dim objApp As Outlook.Application
Dim olnBoxItems as ?????
Dim olNS As Outlook.NameSpace
'Dim objTargetFolder as ???????
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim objCurItem as ??????
Set oInBoxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set olNS = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = objInbox.Folders("TEMP")
Set objCurItem = objCurItem.Move(objTargetFolder)
objCurItem.Save
Exit_moveMsgToTEMP:
Exit Sub
Err_moveMsgToTEMP:
MsgBox "sub moveMsgToTEMP " & Err.Description
Resume Exit_moveMsgToTEMP
End Sub
'---------------------------------------------------------------------------
I want to automate the task of moving the currently open Outlook message into
a folder called "TEMP" I found a code example on this forum but have a few
questions. My variation of the code pasted below.
1) How do I dimension those object variables (note ????? in the code)?
2) Does the code look right?
Thanks in advance for any help you can provide.
Best Regards,
Dean
'---------------------------------------------------------------------------
Public Sub moveMsgToTEMP()
On Error GoTo Err_moveMsgToTEMP
'this sub moves the currently open message to the TEMP folder
Dim objApp As Outlook.Application
Dim olnBoxItems as ?????
Dim olNS As Outlook.NameSpace
'Dim objTargetFolder as ???????
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim objCurItem as ??????
Set oInBoxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set olNS = Item.Application.GetNamespace("MAPI")
Set objTargetFolder = objInbox.Folders("TEMP")
Set objCurItem = objCurItem.Move(objTargetFolder)
objCurItem.Save
Exit_moveMsgToTEMP:
Exit Sub
Err_moveMsgToTEMP:
MsgBox "sub moveMsgToTEMP " & Err.Description
Resume Exit_moveMsgToTEMP
End Sub
'---------------------------------------------------------------------------