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
相关推荐
ken22323 小时前
excel表格为什么越存文件越大? libreoffice 有效
excel
华大哥5 小时前
spring boot 和php 调用 LibreOffice 转换 Excel 到 PDF 完整实现
java·pdf·excel
Codiggerworld21 小时前
Vim 实战:在 VS Code、JetBrains、终端里玩转 Vim
编辑器·vim·excel
开开心心_Every1 天前
多连接方式的屏幕共享工具推荐
运维·服务器·pdf·电脑·excel·tornado·dash
Jun6262 天前
QT(4)-EXCEL操作
开发语言·qt·excel
2501_907136822 天前
Excel文件强效安全修复工具-清理安全风险 可修复WPS编辑后Excel无法打开的文件
excel·wps
一位代码2 天前
Excel 文本连接符 & :基础用法与进阶技巧详解
excel
焱文8192 天前
wps excel指定数据区域,二维码生成区域,批量生成单元格二维码VBA宏代码
excel·wps
夏天里的肥宅水2 天前
EXCEL生成日历
excel
我命由我123453 天前
Excel - Excel 单元格格式同时设置日期时间
运维·学习·职场和发展·excel·求职招聘·职场发展·学习方法