K
Kevin Johnston
I am creating a macro that moves the presently selected mail item to a
public folder. It then applies the MessageClass of a custom mail form
in that folder so additional metadata fields are available. Finally,
it should open the message with the additional fields in that form
showing.
Everything works except the final step. When I use the Display
method, it still opens the message with the original form. If I
manually open the moved item, or open it with a separate macro, it
works fine, but not with the Display code in the original macro. Any
tips?
Here's part of the code:
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
Set objSelItem = objSelection.Item(1)
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = GetFolder("Public Folders/All Public
Folders/MyFolder")
'(Using Sue Mosher's GetFolder function)
NewMC = "IPM.Note.MyForm"
If objSelItem.Class = olMail Then
Set objNewItem = objSelItem.Copy
Set objNewMovedItem = objNewItem.Move(objFolder)
Set objApp.ActiveExplorer.CurrentFolder = objFolder
objNewMovedItem.MessageClass = NewMC
objNewMovedItem.Save
'This is the only part that doesn't work:
objNewMovedItem.Display
End If
Thanks in advance!
public folder. It then applies the MessageClass of a custom mail form
in that folder so additional metadata fields are available. Finally,
it should open the message with the additional fields in that form
showing.
Everything works except the final step. When I use the Display
method, it still opens the message with the original form. If I
manually open the moved item, or open it with a separate macro, it
works fine, but not with the Display code in the original macro. Any
tips?
Here's part of the code:
Set objApp = CreateObject("Outlook.Application")
Set objSelection = objApp.ActiveExplorer.Selection
Set objSelItem = objSelection.Item(1)
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = GetFolder("Public Folders/All Public
Folders/MyFolder")
'(Using Sue Mosher's GetFolder function)
NewMC = "IPM.Note.MyForm"
If objSelItem.Class = olMail Then
Set objNewItem = objSelItem.Copy
Set objNewMovedItem = objNewItem.Move(objFolder)
Set objApp.ActiveExplorer.CurrentFolder = objFolder
objNewMovedItem.MessageClass = NewMC
objNewMovedItem.Save
'This is the only part that doesn't work:
objNewMovedItem.Display
End If
Thanks in advance!