【发布时间】:2021-04-22 04:50:09
【问题描述】:
我一直遇到错误 9。
Dim SavePath As String
Dim SaveAs As String
Dim FileName As String
Dim sDate As String
'// Save it Path
SavePath = "P:\Price book\SQF Food Safety Management System\Records - Monitoring Forms\Production Records\"
'// File Name
FileName = " - Production Record"
'// Format the on "N2" to YYYY-MM-DD
sDate = Format(ThisWorkbook.Sheets("Sheet8").Range("N1"), YYY.MM.DD)
'// Save with File Name & Date & .pdf
SaveAs = sDate & FileName & ".pdf"
Application.DisplayAlerts = True
'// Export Active Sheet as pdf
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
SavePath & SaveAs
Application.DisplayAlerts = True
sDate 超出范围。
我想将工作表导出为 PDF,日期在 N1 单元格中,最后是“ - 生产记录”。
【问题讨论】: