none
Intermittent error: "object invoked has disconnected from its clients" on "CopyMemory" RRS feed

  • Question

  • This error appear intermittently, without any changes in VBA code. Maybe it's a memory issue? A lurking un-terminated object?

    Web-searches for this error bring up results which don't seem related to my code. 

    In summary, i show a user form containing a ListView control, and a button. When the button is clicked, i get a ribbon object using it's pointer:

        ' hydrate temp obj-var from RAM, using ribbon pointer-address
        Dim objRibbon As Object
        CopyMemory objRibbon, lRibbonPointer, LenB(lRibbonPointer)

    That's the line on which i receive this error message, but not every time. Only sometimes. 

    thx for any suggestions!




    • Edited by johny w Wednesday, June 1, 2016 9:11 PM
    Wednesday, June 1, 2016 9:02 PM

Answers

  • Hi Deepak

    Thx for reply. I have solved this. 

    Research on this issue generally indicates it's related to object-handling-- failure to fully qualify a name, failure to destroy an object after use, or other object conflict that confuses the VB interpreter. 

    The fix in my case was:

    • Previously, my project restored the object from persistence using CopyMemory each time i used the object. i changed it to re-use the existing object-variable if available, and only use CopyMemory if the object was lost. Repeatedly overwriting the object variable with CopyMemory on every use may be a source of instability. 

    Problem fixed. 

    Your suggestion to save and close the file after copymemory is not applicable, as closing the workbook would lose the object we are creating with CopyMemory, so that won't really help. 

    thx

    • Marked as answer by johny w Thursday, June 2, 2016 7:44 PM
    • Edited by johny w Saturday, June 4, 2016 10:38 PM
    Thursday, June 2, 2016 7:43 PM

All replies

  • Hi johny w,

    you have mentioned above that only sometimes this error occurs.

    can you distinguish in which situation it occurs and in which situation code works correctly.

    I also find regarding your error but there is no information that relate to your issue.

    The other thing I want to confirm that did you try to save the workbook after copying.

    in some issue I find that if you do saveas your workbook with the same name after copying and then close it solves this kind of issue.

    Regards

    Deepak


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, June 2, 2016 2:42 AM
    Moderator
  • Hi Deepak

    Thx for reply. I have solved this. 

    Research on this issue generally indicates it's related to object-handling-- failure to fully qualify a name, failure to destroy an object after use, or other object conflict that confuses the VB interpreter. 

    The fix in my case was:

    • Previously, my project restored the object from persistence using CopyMemory each time i used the object. i changed it to re-use the existing object-variable if available, and only use CopyMemory if the object was lost. Repeatedly overwriting the object variable with CopyMemory on every use may be a source of instability. 

    Problem fixed. 

    Your suggestion to save and close the file after copymemory is not applicable, as closing the workbook would lose the object we are creating with CopyMemory, so that won't really help. 

    thx

    • Marked as answer by johny w Thursday, June 2, 2016 7:44 PM
    • Edited by johny w Saturday, June 4, 2016 10:38 PM
    Thursday, June 2, 2016 7:43 PM