Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / September 2004

Tip: Looking for answers? Try searching our database.

Refreshing an item after changing the form type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pau Larsen - 13 Sep 2004 11:16 GMT
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
Hollis D. Paul - 13 Sep 2004 21:54 GMT
> Any idea for how I can get the items form refreshed
> automatically when clicking the button?

You have to set MyItem to nothing, and then recreate it.

Hollis D. Paul [MVP - Outlook]
Hollis@outhousebythesound.com
Using Virtual Access 4.52 build 277 (32-bit), Windows 2000 build 2600
http://search.support.microsoft.com/kb/c.asp?FR=0&SD=TECH&LN=EN-US
     
Mukilteo, WA  USA
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.