none
Script error The operation failed. Line No:450 code -2147467259 RRS feed

  • Question

  • My Outlook 2010 appointment form on the P.2 (renamed to "Personal Performance Variable")page and vbScript code works fine, but whenever a new appointment is created, it spews that message 3 times in a row. There aren't any ill effects except that the user gets annoyed clicking "OK" 3 times in a row.
    Error checking reveals error code: -2147467259.
    Line 450 in my code exists in the Sub Item_PropertyChange(ByVal Name) procedure.
    What seems to be happening is that it retries and fails 3 times in a row but on the 4th attempt is successful in creating the object.
    It setting up the object for the custom form page as follows:

    Sub Item_PropertyChange(ByVal Name) 
    dim pvPage
    ' This next Set pvPage is throwing operation failed error 3 times on startup. It's like it couldn't find the page on initial launch, but after the 3rd error finds the page object and continues on without further problems. 
    Set pvPage = Item.GetInspector.ModifiedFormPages("Personal Performance Variable") 
    dim chkUseDuration : Set chkUseDuration = pvPage.Controls("chkUseDuration")
    ...<snip>...

    What is unexpected is that this event trigger is happening before my Sub Item_Open() kicks in.

    Any ideas on what is going on here? Is there a way to prevent triggers from firing before the Item_Open() is performed?

    Thursday, June 21, 2012 2:37 PM

Answers

  • At the top level of the script code:
     
        Dim blnOKToProcess ' Boolean
     
    In the open event handler:
     
        blnOKToProcess = True
     
    In the property change event:
     
        If blnOKToProcess = True Then
            ' do whatever, set the modified form page
        End If

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Harder905" <=?utf-8?B?SGFyZGVyOTA1?=> wrote in message news:3efd1f01-dada-4f0f-becc-49935efb1f7b...

    Thanks DamianD, I'm glad it looks possible.

    Could you (or someone) point me to how to set and clear these flags that allow/prevent triggers? I'm not able to find any reference to them online - yet.


    Ken Slovak MVP - Outlook
    • Marked as answer by Harder905 Thursday, June 21, 2012 3:58 PM
    Thursday, June 21, 2012 3:47 PM
    Moderator

All replies

  • sure, you can set a flag in item_open event that processing propertychange event is safe now. General rule - you should access inspector and UI related objects when inspector_activate event is fired, anything sooner might fail.
    Thursday, June 21, 2012 2:59 PM
  • Thanks DamianD, I'm glad it looks possible.

    Could you (or someone) point me to how to set and clear these flags that allow/prevent triggers? I'm not able to find any reference to them online - yet.

    Thursday, June 21, 2012 3:34 PM
  • At the top level of the script code:
     
        Dim blnOKToProcess ' Boolean
     
    In the open event handler:
     
        blnOKToProcess = True
     
    In the property change event:
     
        If blnOKToProcess = True Then
            ' do whatever, set the modified form page
        End If

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "Harder905" <=?utf-8?B?SGFyZGVyOTA1?=> wrote in message news:3efd1f01-dada-4f0f-becc-49935efb1f7b...

    Thanks DamianD, I'm glad it looks possible.

    Could you (or someone) point me to how to set and clear these flags that allow/prevent triggers? I'm not able to find any reference to them online - yet.


    Ken Slovak MVP - Outlook
    • Marked as answer by Harder905 Thursday, June 21, 2012 3:58 PM
    Thursday, June 21, 2012 3:47 PM
    Moderator
  • Works like a charm!

    Thanks greatly to both DamianD for the concept and Ken Slovak for the code.

    Thursday, June 21, 2012 3:58 PM