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
相关推荐
JoshRen3 小时前
2026教程:上传Excel,用Gemini 3镜像站多模态一键生成问卷分析图表代码与结论(附国内免费方案)
excel
实战编程1 天前
Temu 插件导出 Excel 图片问题总结(SheetJS / ExcelJS)
excel
Data-Miner1 天前
用DeepSeek V4做表:数以轻舟Agent让做Excel表像聊天一样简单
microsoft·excel
Eiceblue2 天前
使用 C# 将 Excel 转换为 Markdown 表格(含批量转换示例)
开发语言·c#·excel
Java面试题总结2 天前
使用 Python 设置 Excel 数据验证
开发语言·python·excel
追逐梦想永不停2 天前
记录一个好用的excel判断数字格式的公式
前端·chrome·excel
Eiceblue2 天前
C# 如何实现 Word 转 Excel ?分享两种实用方法
c#·word·excel
CircleMouse3 天前
如何设置wps单元格下拉选项设置
excel·wps
zhangjin12223 天前
kettle插件-excel插件,kettle读取excel动态表头,kettle根据列名读取excel
excel·kettle·kettle excel插件·kettle 动态excel
远洪4 天前
excel 找出两列不同的数据
excel