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
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
Thanks at advance
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
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