+ Reply to Thread
Results 1 to 16 of 16

-2147417848 automation error the object invoked has disconnected from its clients

  1. #1
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    -2147417848 automation error the object invoked has disconnected from its clients

    Hi

    I get this error if I move away from excel to some other window while my macro is running.

    -2147417848 automation error the object invoked has disconnected from its clients

    I was not getting this earlier.

    MSDN says "Make sure that you set Option Explicit at the top of each file in your project."

    I am adding some sheets at run time. How can I add Option Explicit at the top of added sheets? And, will that solve my problem?

    Are there any otehr suggestions?

    Thanks
    Ajay

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    You're not adding code to those sheets as you add them, are you?

    You can start by ensuring it's at the top of every module initially.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    No, I am not adding any code there.
    What could be other reasons for this error?
    I was not getting it earlier. Suddenly, started getting this since past few days.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    That seems to resolve it in many cases, after you declare your variables appropriate to usage.

    What are you doing that's exotic?

  5. #5
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Well, it is a complicated code (to a newbie like me, anyways) running into more than 5k lines of code that adds sheets, rows and columns, merges cells, deletes sheets, creates graph, adds controls at run time, etc, to name a few.
    (But, I have written the entire code. So,I know what the code does.)

    Pl. note that
    a) This error was not occuring ealrier. Started occuring only recently.
    b) I ran my old version (about a month old) of code. That is also giving this error now. So, any recent code change doesn't seem to be reason.
    c) The error comes only when I move focus away from the excel to some other appliction, while macro is running.

    Can you elaborate more on "declare your variables appropriate to usage"?

    thanks
    Ajay

  6. #6
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Any thoughts on this, anyone?

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    more than 5k lines of code
    In how many modules?

    How large is the largest module when exported as a bas file?

  8. #8
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Biggest module is 5547 lines of code (about 500-1000 of that will be commented code). And a sheet has about 600 lines of code. Two other sheets have less than 50 lines each.

    Biggest module is 279KB when exported as a bas file.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Think you need to chop it up; 64K is the upper limit, but I'd expect (don't know for sure) that that's for code, not comments.

    Meanwhile, do you indeed have Option Explicit at the top of all used modules?

  10. #10
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Hi

    I chopped up my module into 4 such that the biggest bas file is 61k.

    I re-checked that I have Option Explicit at the top of all used modules.

    But this still didn't help.

    I have got following code in "ThisWorkbook". Could this be a problem, since the issue comes only when I move away from this file, to another file, while macro is running?
    I commented this, but the problem persists.

    Please Login or Register  to view this content.

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    You don't want error handlers in code until fully tested, unless it displays the error number etc
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  12. #12
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Hi

    Thanks. Your suggestion worked!!
    I took off error handlers, and at least now I know *where* I am getting the error.
    This is the line that errors:-
    Please Login or Register  to view this content.
    What is wrong with this replace statement?

    tia
    Ajay

  13. #13
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Hi

    Does anyone have any suggestions / workaround for this problem please?

    thx
    Ajay

  14. #14
    Registered User
    Join Date
    07-03-2011
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    I have the same message popping up - only recently. It comes up when a user has to select a Forename from drop down to search for a patient record....

    Please Login or Register  to view this content.
    the line with lst master list becomes highlighted when I ask debugger to show me what's wrong. Any ideas?

  15. #15
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

  16. #16
    Registered User
    Join Date
    07-03-2011
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: -2147417848 automation error the object invoked has disconnected from its clients

    Very very sorry. Forgotten about this! Thought it may be easier ! Creating new thread already! Again - very sorry !

+ 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