我运行了一个宏,该宏生成要保存为PDF的工作表。当我运行下面的方法时,出现错误消息,告诉我我的文档未保存(Run=time error '-2147024773 (8007007b)': Document not saved
。
我相信这可能是我要提供的文件名...但不确定。乐意提供任何进一步的信息。
所有变量均已公开声明
Public Sub toPDF()
PDFName = "Pinger Report_" & Format(Now, "dd/mm/yyyy hh:mm:ss")
sumPDFSheet.Cells(5, 4).Value = Format(Now, "dd/mm/yyyy hh:mm:ss")
finalPDFName = PDFPath & PDFName
'create borders around failed devices range on pdfsheet
With sumPDFSheet.Range(sumPDFSheet.Cells(24, 3), sumPDFSheet.Cells(k - 1, 5)).Borders
.LineStyle = xlContinuous
End With
'creates heading rows for each page in the pdf and centers correctly
sumPDFSheet.PageSetup.PrintTitleRows = sumPDFSheet.Rows(1).Address
sumPDFSheet.PageSetup.CenterVertically = False
sumPDFSheet.PageSetup.CenterHorizontally = True
'method call to format columns
allColumns
'save as pdf to correct folder with correct name
With sumPDFSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=finalPDFName, openafterpublish:=False 'ERRRORRRRRRRRRERRRR
End With
End Sub
最佳答案
答案:要提供的正确文件扩展名。
关于vba - 使用.ExportAsFixedFormat保存文件时出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40643249/