Refreshing an item after changing the form type

P

Pau Larsen

Hi,

I have created a piece of code for changing an items form
type:

Public Sub ChangeMessageType()
Dim myolapp As Outlook.Application
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.AppointmentItem
Set myolapp = CreateObject("Outlook.Application")
Set myinspector = myolapp.ActiveInspector
Set myItem = myinspector.CurrentItem

myItem.MessageClass = "IPM.Appointment.Timereg"

myItem.Save
myItem.Close olSave

myItem.Display
'myolapp.GetNamespace("MAPI").GetItemFromID
(myItem.EntryID).Display
End Sub

I tricker it as a macro by pressing a button on the items
toolbar. The type (MessageClass) is changed just fine. I
then try to refresh the item to reflect the changes by
closing and reopening the item.

But when I do that programmatically like in the code
above the forms type is not refreshed. At least not the
displaying of the item - the properties actually tells
that the type has changed! The last outcommented line in
the code shows that I have tried to open the item
directly from the ID reference - but the result is the
same.

If I remove the line that reopens the item and then
reopens manually it works fine.

Any idea for how I can get the items form refreshed
automatically when clicking the button?

/Pau
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top