使用当前工作簿名称将excel另存为PDF在当前文件夹中 [英] Save excel as PDF in current folder using current workbook name

查看:71
本文介绍了使用当前工作簿名称将excel另存为PDF在当前文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试将工作簿中的一组图纸以PDF格式保存到同一文件夹,并使用工作簿名称.

Trying to save a set of sheets from a workbook to PDF format to the same folder and using workbook name.

在记录完所有步骤的宏之后,返回并尝试用我在该论坛的某些线程中找到的代码替换代码段,但现在它无法正常工作.

After recording the macro with all the steps went back and tried to replace the pieces of the code by what I found in some of this forum's threads but now it is not working.

当前版本如下.我弄破了什么?

Current version is below. What did I break?

SaveToPDF Macro

Sheets(Array("AUDIT Info", "REVIEW", "FILES", "WARNINGS", "PURGE", "NonBIM", _
    "Clashes", "ViewsManagement")).Select
Sheets("AUDIT Info").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    ThisWorkbook.Path & "\" & ActiveWorkbook.Name _
    , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
    :=False, OpenAfterPublish:=True
Sheets("AUDIT Info").Select

推荐答案

尝试以下代码:

Option Explicit

Sub SaveSheetsasPDF()

ThisWorkbook.Sheets(Array("AUDIT Info", "REVIEW", "FILES", "WARNINGS", "PURGE", "NonBIM", "Clashes", "ViewsManagement")).Select

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
    ThisWorkbook.Path & "\" & ThisWorkbook.Name, _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, OpenAfterPublish:=True

End Sub

这篇关于使用当前工作簿名称将excel另存为PDF在当前文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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