+ Reply to Thread
Results 1 to 4 of 4

"The object invoked has disconnected from its clients"

  1. #1
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    "The object invoked has disconnected from its clients"

    I have a "Clear All" button that runs a macro that clears the contents of various cells, resets some check boxes and does some other resetting on various sheets within a spreadsheet.

    There are a few cells in this spreadsheet which by default contain formulas (which fetch data from other sheets if data is entered on those sheets), but the user also has the option of directly data in those cells (using a pulldown), thus overwriting the formulas.

    Part of the "Clear All" button will clears the contents of these cells, and then puts the original formulas back in. However, these cells also contain conditional formatting (they turn red if the cell to the left has a figure entered into it, but the current cell is blank), and they also contain data validation. I have found in the past that it is not possible to enter a formula in a cell while it has data validation, because the formula does not match anything from the data validation list. Therefore, the macro does this (it's not pretty, but it works):

    1 - clears the contents of the cell (any data that might have been entered, be it directly typed, via the pulldown, or via the formula)
    2 - clears the data validation from the cell (to allow the original formula to be put back in)
    3 - puts the original formula back in
    4 - puts the data validation back in

    The odd bit is, when the sheet in question in unprotected, the macro runs fine. But when the sheet in question is protected (bearing in mind that the cell itself is unprotected), the macro crashes, with the error message:

    "The object invoked has disconnected from its clients", with this highlighted:

    Please Login or Register  to view this content.
    Is there a way I can get this macro to work without having to just leave the sheet unprotected?

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: "The object invoked has disconnected from its clients"

    you could unprotect the sheet in the code before running your clean up then reprotect it afterwards
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: "The object invoked has disconnected from its clients"

    That I could. Would you happen to know the command and syntax for protecting and unprotecting sheets within a macro?

  4. #4
    Forum Contributor
    Join Date
    12-09-2011
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    201

    Re: "The object invoked has disconnected from its clients"

    Never mind, I found the command online, and it works a treat. Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1