Automation Error - The object invoked has disconnected from its clients

vics_roo

Board Regular
Joined
Apr 3, 2015
Messages
75
Hi,

I need to create a new workbook, holds 3 worksheets - Errors,REPORT,Summary
I copy that worksheets from current workbook to a new one.
The REPORT worksheet holds 2 pivot tables and slicers.

I catch the following error
Code:
Automation Error -2147417848 
The object invoked has disconnected from its clients
and Excel is force closing after that. I was checking the new REPORT workbook after that - it's clean.

On my PC with Office 2010 it's works fine - here is no errors(all works fine), but error is appearing with Office 2013

I tried to use different statements, but I don't fix error

Here is fragment of my code
Code:
Dim outputWorkbook As Workbook
Set outputWorkbook = Workbooks.Add
Dim dt As String
Dim outFilename As String
dt = Format(CStr(Now), "ddmmyyyyhhmmss")
outFilename = ThisWorkbook.Path & "\REPORT_" & dt
outputWorkbook.SaveAs outFilename
'trying copy1 
'currentWB.Worksheets("Errors").Copy outputWorkbook.Worksheets(1)
'currentWB.Worksheets("REPORT").Copy outputWorkbook.Worksheets(2)
'currentWB.Worksheets("Summary").Copy outputWorkbook.Worksheets(3)
'trying copy2
currentWB.Worksheets("Errors").Copy before:=outputWorkbook.Sheets(1)
currentWB.Worksheets("REPORT").Copy before:=outputWorkbook.Sheets(1) '<-ERROR IS HERE
currentWB.Worksheets("Summary").Copy before:=outputWorkbook.Sheets(1)
outputWorkbook.Close savechanges:=True

Thanks at advance
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,215,493
Messages
6,125,122
Members
449,206
Latest member
burgsrus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top