我已经成功运行了一个宏,该宏将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)