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
相关推荐
办公解码器14 小时前
Excel工作表打开一次后自动销毁文件,回收站中都找不到
数据库·excel
mudtools16 小时前
.NET驾驭Excel之力:工作簿与工作表操作基础
c#·.net·excel
mudtools16 小时前
.NET驾驭Excel之力:单元格与区域操作详解
c#·.net·excel
秋天之落叶20 小时前
使用ADO将excel表内容加载到mssql表中的长度问题
数据库·sqlserver·excel
1314lay_100720 小时前
SAP ABAP 导入excel表,导多个sheet
excel·abap
玩泥巴的1 天前
.NET驾驭Excel之力:工作簿与工作表操作基础
c#·excel·二次开发·office·com互操作
mysusheng2 天前
2025 批量下载微博内容/图片/视频,导出word和pdf,微博点赞/评论/转发等数据导出excel
pdf·word·excel
办公解码器2 天前
Excel工作簿自动销毁功能,使用时间到期后自动删除文件
excel
MediaTea2 天前
Python 第三方库:OpenPyXL(Excel 文件读写与操作)
开发语言·python·excel
开开心心就好2 天前
无需函数:Excel数据筛选工具推荐
xml·网络·pdf·华为云·word·excel·音视频