导出为PDF仅打开第二张图表 [英] Exporting As PDF opens only second chart

查看:98
本文介绍了导出为PDF仅打开第二张图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将报告"工作表导出为PDF并打开它.问题在于开放的只是该工作表底部的第二张图表.

Trying to export my "Report" worksheet as a PDF and open it. Issue is that all that's opening up is the second chart at the bottom of that worksheet.

我的代码:

ThisWorkbook.Sheets("Report").Activate
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=ActiveWorkbook.Path & "\Report.pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

应该在PDF中显示什么:

What's supposed to be showing in the PDF:

PDF中实际显示的内容:

What's actually showing up in the PDF:

推荐答案

这是Excel的一个众所周知的问题:为此,ActiveSheet也可以是一个图表... 如果您有一个活动图表,则将导出该图表.

It is a well known problem of Excel: For it ActiveSheet can be a Chart, too... If you have an active chart, this one will be exported.

因此,将其放置在导出行之前就足够了:

So, it is enough to place before the exporting line :

ActiveSheet.Range("A1").Select

或者确保未选择图表甚至更好的图表,请尝试将表格的资格设置为:

Or be sure that a chart is not selected and even better, try qualifying your sheet as:

Dim sh As Worksheet

Set sh = Worksheets("sheet_name")

这篇关于导出为PDF仅打开第二张图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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