View Single Post
  #1  
Old October 30th 06, 05:07 PM posted to microsoft.public.outlook.program_vba
meokey
external usenet poster
 
Posts: 1
Default help: AppointmentItem.copy fail problem

In a section of VBA in Outlook, I need to copy a appointment item (named
Item, in PST file) to another Calendar in Mailbox of Exchange server. I add a
UserProperty, RndID, to the appointmentitem, Item. But I find the
userproperty didn't be copied.

The code is as following:


Set myprop = Nothing
Set myprop = Item.UserProperties.Find("RndID")
If TypeName(myprop) = "Nothing" Then
Set myprop = Item.UserProperties.Add("RndID", olNumber)
myRndID = Int(Rnd() * 100000)
Item.UserProperties("RndID").Value = myRndID
Item.Save
End If
........
Item.Body = "testtest" & " " & myRndID
Item.Save
Set myCopiedItem = Item.Copy
myCopiedItem.Move myMailboxCal
MsgBox myCopiedItem.UserProperties("RndID").Value, , "Copied to
Mailbox"


The last code, which is to validate whether the whole item including all
properties is copied, failed with the message: Object variable or With block
variable not
set. Of couse, the body of the appointmentitem in Mailbox is blank. It shows
that the properties of RndID and Body of Item in PST did NOT be copied to
myCopiedItem and moved to myMailboxCal.

Any comments/suggestions will be very appreciated.
Ads
 

Share Prices - Property in Spain - Loans - Loans - Mortgages