“Automation Error: Object Invoked has disconnected from its clients”

前端 未结 4 1956
鱼传尺愫
鱼传尺愫 2021-01-13 22:20

I figured out what Nick was suggesting, and the following is the error number & description that I\'m getting:

\'-2147417848 (80010108)\' Automation

相关标签:
4条回答
  • 2021-01-13 22:23

    Make sure your sheet is not protected with cells locked while doing insert. This could be one of the reason why the code will fail. This code was working for me on one folder, but when I copied the excel macro file to another folder I started getting this error. Since it is only for formatting, I avoided using the below codes altogether and did formatting the usual way and not copying from above rows. Note that in first code, entire row gets selected and if you have protected cells, it could lead to failure.
    'Rows(r + 3 & ":" & r + 3).Select 'Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

    0 讨论(0)
  • 2021-01-13 22:25

    This solution works for me:

    Before adding rows with Shift:=xlDown delete bottom rows on the worksheet

    'ADD THE ROWS YOU WANT
    
    Sheets("XXXXXX").Range("A100000:A100100").EntireRow.Delete
    
    With Selection
    .Copy
    .Insert Shift:=xlDown
    End With
    
    0 讨论(0)
  • 2021-01-13 22:29

    Ok... It's been well over 1 month now, and I've finally fixed this!! Fortunately & Unfortunately, it had absolutely nothing to do with my code. Instead, it was an MS Office Vs. Windows 8 problem. To fix it, I ran the compatability troubleshooter, and all is back to perfect again:

    1. Open MS Excel (Any File or new file)
    2. Pull up Task Manager
    3. Click on MS Office or Excel Icon in Background Processes, Right click, and select properties
    4. Under Compatibility, Click "Run Compatibility Troubleshooter"
    5. When finished running, test file again, if it works right, click apply settings to this program. If it doesn't work, click next and choose from the options. (I chose that it worked in previous version of Windows (Windows 7) Then click Next again.
    6. Test file again, and it worked.

    I cannot believe that this is all I had to do the whole time! I actually spent $149 thinking that Microsoft Support could remote in and fix it, but that was an absolute waste! I was transferred to 12+ different people/departments, and still got nothing from them. I finally stumbled across the solution this morning....

    Anyway, thanks to everyone who posted and tried to help me with this. I always log off of this site with better VBA skills than I signed on with because of all of you... So Thanks again!

    0 讨论(0)
  • 2021-01-13 22:29

    I had the same issue, with some macros that were working for everyone but not 1 person.

    I solved it by asking the person to not use a folder that was synced to OneDrive, so be careful when using OneDrive.

    I had other cases where OneDrive marked downloaded files from BOX or other file sharing services as read only, and made macros error out. And all you would need to do is open the file, save it and open it up again, but allot of people blamed it on my macros. It took me a while to find the cause, and to find a way to save an reopen the file using macros, before it actually opens...

    0 讨论(0)
提交回复
热议问题