Dim Book As New XLS.Book(ProjectPath & "Attachments\询价单.xls")
Dim fl As String = ProjectPath & "Reports\询价单.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim flt1,flt2 As String
flt1 = fl
flt2 = ProjectPath & "Reports\询价单.pdf"
If Not FileSys.FileExists(flt1) Then
Messagebox.Show("文件不存在或已经被删除!","提示")
Return
End If
Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(flt1)
wb.ExportAsFixedFormat(MSExcel.XlFixedFormatType.xlTypePDF, flt2)
App.Quit
执行上面代码的时候 出现如下报错
---------------------------
版本:2014.3.8.1
---------------------------
代码执行出错,错误信息:
System.ArgumentException: 值不在预期的范围内。
在 Microsoft.Office.Interop.Excel.WorkbookClass.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr)
在 UserCode.Test()
---------------------------
确定
---------------------------
[此贴子已经被作者于2014-4-11 12:29:02编辑过]