【发布时间】:2020-12-12 09:29:48
【问题描述】:
我有一个 VBA 用户表单,用户可以在其中搜索数据库表中的某些术语。它在单独的表格中生成结果,当用户单击打印按钮时,它会创建一个 PDF,其中包含搜索结果表格中的所有数据。
编译错误
“应用程序:定义的或对象定义的错误”
Sub CreatePDF()
Sheet4.Select
Range("A1:N25").Select
ThisWorkbook.Sheets("SearchData").Select
Selection.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:="D:\AliBinAli\Security Visitor App\temp.pdf", _
Quality:=xlQualityStandard, _
Orientation:=xlLandscape, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Sheet4.Select
Range("A1").Select
End Sub
突出显示的行是:
Selection.ExportAsFixedFormat _ Type:=xlTypePDF, _
Filename:="D:\AliBinAli\Security Visitor App\temp.pdf", _
Quality:=xlQualityStandard, _
Orientation:=xlLandscape, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
【问题讨论】:
-
突出显示哪一行?
-
Selection.ExportAsFixedFormat _ Type:=xlTypePDF, _ Filename:="D:\AliBinAli\Security Visitor App\temp.pdf", _ Quality:=xlQualityStandard, _ Orientation:=xlLandscape, _ IncludeDocProperties:=True, _ IgnorePrintAreas:=False, _ OpenAfterPublish:=True