小编Ste*_*eve的帖子

错误运行时错误'1004'未保存文档。

我已经成功运行了一个宏,该宏将Excel工作表另存为PDF并通过电子邮件发送给我的执行团队。

我通过创建新表来重新设计它,并相应地更新了代码。

Sub NewDashboardPDF()

' New Executive Daily Dashboard Macro
'
' Create and email the Executive TEAM the Daily Dashboard.
    Dim strPath As String, strFName As String
    Dim OutApp As Object, OutMail As Object

' Create and email the Daily Report to Mitch/Dave/John/Jason ALL PAGES.
    Sheets("Executive Dashboard").Select
    strPath = Environ$("temp") & "\" 'Or any other path, but include trailing "\"
    strFName = Worksheets("Executive Dashboard").Range("V2").Value & " " & Format(Date, "yyyymmdd") & ".pdf"

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        strPath & strFName, …
Run Code Online (Sandbox Code Playgroud)

excel vba excel-vba

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

excel ×1

excel-vba ×1

vba ×1