Method 'Copy' of object 'Sheets' failed

試著忘記壹切 提交于 2020-07-09 19:15:29

问题


After reinstalling Office 2013 I got this error:

Run-time error '-21474178848 (80010108)':
Method 'Copy' of object 'Sheets' failed

In this the code block:

Set ThisWork = ActiveWorkbook
    strExt = ThisWork.Sheets("Catalog1").Cells(2, 4).Value & "_" & Format(Now, "yyyy_mm_dd_hhmmss")
    strSaveName = ThisWork.Path & "\" & strExt & ".xlsx"

    ThisWork.Sheets(Array("Catalog1", "Catalog2", "Translations")).Copy
    With ActiveWorkbook
...

After pressing debug and pressing Continue (F5), Excel crashes.

Why does this happen?


回答1:


Check Sheets names in VBA Windows

In your case it probable wrong names in (name) section which depends on Excel localization. try to change (name) value which you have probably sheet1 or sheet2 and change it to Catalog1 or Catalog2 so whey must much name section.

So now you may have

Sheet1 (Catalog1)
Sheet2 (Catalog2)

You must rename to

Catalog1 (Catalog1)
Catalog2 (Catalog2)


来源:https://stackoverflow.com/questions/34493808/method-copy-of-object-sheets-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!