VBA错误1004:方法“关闭". Chart.ChartData.Workbook对象失败 [英] VBA Error 1004 : Method "Close" of Chart.ChartData.Workbook object Failed

查看:361
本文介绍了VBA错误1004:方法“关闭". Chart.ChartData.Workbook对象失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个宏,可以从每月更新的Excel文件中更新ppt演示图表.几个月以来,它一直像一个烟熏锅一样工作.从几天前开始,我在更新图表工作表编号后无法关闭图表工作簿,并且遇到了1004运行时错误.

I have a macro that updates a ppt presentation charts from a monthly updated Excel file. It has been working like a charme for a couple of months. Since a few days ago, I have a problem to close the charts Workbook after updating their numbers and I get a 1004 runtime error.

这是代码:

    With .Slides(1).Shapes("gmbDiscoveryRateChart").Chart.ChartData
    .Activate
    .Workbook.Sheets(1).Range("B2").value = currentGmbDiscoveryRate
    .Workbook.Sheets(1).Range("B3").value = 1 - currentGmbDiscoveryRate
    .Workbook.Close '<-- Error here
    End With

推荐答案

尝试Workbook.Application.Quit 可能有帮助.

Try Workbook.Application.Quit It might help.

这篇关于VBA错误1004:方法“关闭". Chart.ChartData.Workbook对象失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆