We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


cut/copy from one field to another

Medium Priority
Last Modified: 2012-05-06
I'm trying to get information from fields in which I 'parked' information for custom fields.

I'm using a virtual basic script. I keep getting errors telling me that:

Automation error (Error 440)

When you access Automation objects, specific types of errors can occur. This error has the following cause and solution:

An error occurred while executing a method or getting or setting a property of an object variable. The error was reported by the application that created the object.
Check the properties of the Err object to determine the source and nature of the error. Also try using the On Error Resume Next statement immediately before the accessing statement, and then check for errors immediately following the accessing statement.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Why would this occur with this code? And could someone point to a place that lists each field's term in the VB script. Code is below
Sub ConvertFields()
  Dim objApp As Application
  Dim objNS As NameSpace
  Dim objFolder As MAPIFolder
  Dim objItems As Items
  Dim objItem As Object
  Set objApp = CreateObject("Outlook.Application")
  Set objNS = objApp.GetNamespace("MAPI")
  Set objFolder = objNS.PickFolder
  If Not objFolder Is Nothing Then
    Set objItems = objFolder.Items
    For Each objItem In objItems
      ' make sure you have a Contact item
      If objItem.Class = olContact Then
        ' convert to your published custom form
        objItem.MessageClass = "IPM.Contact.Recurrent Client"
        ' copy data to your custom fields
        objItem.UserProperties("Attorney 1") = objItem.User1
        objItem.UserProperties("Contact Date 1") = objItem.User2
        objItem.UserProperties("Matter 1") = objItem.User3
        objItem.UserProperties("Client Number 1") = objItem.User4
        objItem.UserProperties("Open Closed 1") = objItem.Anniversary
        objItem.UserProperties("Open Closed 2") = objItem.AssistantsPhone
        objItem.UserProperties("Attorney 3") = objItem.BusinessCountry
        objItem.UserProperties("Open Closed 3") = objItem.HomeCountry
        objItem.UserProperties("Matter 3") = objItem.OtherCountry
        objItem.UserProperties("Contact Method") = objItem.Callback
        objItem.UserProperties("Contact Date 4") = objItem.CarPhone
        objItem.UserProperties("Conflict") = objItem.CompanyMainPhone
        objItem.UserProperties("Attorney 2") = objItem.ISDN
        objItem.UserProperties("Contact Date 3") = objItem.RadioPhone
        objItem.UserProperties("Client Number 4") = objItem.TTYTDDPhone
        objItem.UserProperties("Client Number 3") = objItem.Telex
        objItem.UserProperties("Client Number 2") = objItem.Account
        objItem.UserProperties("Matter 4") = objItem.AssistantsName
        objItem.UserProperties("Open Closed 4") = objItem.BillingInformation
        objItem.NickName = objItem.BusinessAddressPOBox
        objItem.UserProperties("Internal Referral 1") = objItem.Email3Adress
        objItem.UserProperties("Internal Referral 2") = objItem.Email3Type
        objItem.UserProperties("Contact Date 2") = objItem.Email3DisplayName
        objItem.UserProperties("Client") = objItem.HomeAddressPOBox
        objItem.User1 = ""
        objItem.User2 = ""
        objItem.User3 = ""
        objItem.User4 = ""
        objItem.Anniversary = ""
        objItem.AssistantsPhone = ""
        objItem.BusinessCountry = ""
        objItem.HomeCountry = ""
        objItem.OtherCountry = ""
        objItem.Callback = ""
        objItem.CarPhone = ""
        objItem.CompanyMainPhone = ""
        objItem.ISDN = ""
        objItem.RadioPhone = ""
        objItem.TTYTDDPhone = ""
        objItem.Telex = ""
        objItem.Account = ""
        objItem.AssistantsName = ""
        objItem.BillingInformation = ""
        objItem.BusinessAddressPOBox = ""
        objItem.Email3Address = ""
        objItem.Email3Type = ""
        objItem.Email3DisplayName = ""
        objItem.HomeAddressPOBox = ""
      End If
  End If
  Set objItems = Nothing
  Set objItem = Nothing
  Set objFolder = Nothing
  Set objNS = Nothing
  Set objApp = Nothing
End Sub

Open in new window

Watch Question

Top Expert 2010

Hi, fragilabsolut.

"Why would this occur with this code? "
First, do you know what line of code is causing the error?  That would help a lot.  The code looks ok to me.  Without knowing where the error is occurring at, my guess is that some of the user properties don't exist when the code is trying to assign a value to them.  I don't believe that setting the MessageClass to yoour custom form creates the user properties.  I expect the code is going to have to create them before assigning a value to them.

"a place that lists each field's term in the VB script"
Sorry, I don't understand what you're asking.
Actually,  I figured out my problem.  I had some stuff incorrectly named.

That's what I was asking about with "a place that lists..."
For example:

{objItem.CarPhone} should have been {objItem.CarTelephoneNumber}

Thanks for the help.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Top Expert 2010

You're welcome.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.