View Single Post
  #2  
Old October 31st 06, 01:25 AM posted to microsoft.public.outlook.program_vba
Jeff
external usenet poster
 
Posts: 30
Default help: AppointmentItem.copy fail problem

As a first step, you could use Outlook or OutlookSpy to double-check
that the property did not get copied.

On Oct 30, 11:07 am, meokey wrote:
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
 

Credit Cards - Debt Consolidation - Loans - Bankruptcy - vShare YouTube Clone