VBA将当前打开的表格生成PDF图片

前言

VBA将当前的表格存储成PDF文件进行存储

代码

vbscript 复制代码
Sub ExportToPDF()
    Dim FilePath As String
    Dim FileName As String
    Dim ExportRange As Range
    
    ' 设置导出文件路径及名称
    FilePath = "D:\Users\"
    FileName = "ExportedPDF"
    
    ' 设置导出区域范围
    Set ExportRange = Range("B1:BE38")
    
    ' 导出区域到 PDF 文件
    ExportRange.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=FilePath & FileName & ".pdf", Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
相关推荐
徐赛俊22 分钟前
Excel 图表一键导出到 PPT(单页精准排版)教程
powerpoint·excel
智航GIS5 小时前
9.3 Excel 自动化
python·自动化·excel
骑着蜗牛闯宇宙6 小时前
TP8上传Excel地址数据批量标注到高德地图
数据库·php·excel
魅惑青花瓷6 小时前
【EXCEL动态获取数据范围并整列自动填充公式】
excel
zbguolei1 天前
上传 Excel 文件进行数据库比对--增加导出功能
数据库·excel
!chen1 天前
Excel高性能异步导出完整方案
excel
杰瑞不懂代码1 天前
使用pandas操作EXCEL表格入门教程
python·excel·pandas·办公自动化·数据处理
yiSty1 天前
win10/win11安装Word、EXCEL、PPT、VISIO
word·powerpoint·excel
zbguolei2 天前
上传 Excel 文件进行数据库比对
数据库·excel