我有一个打印一些报告的 VB6 应用程序。其中一份报告具有通过代码插入的子报告。
加载子报表的函数是这样的:
Public Function loadSubreport(destSection As CRAXDRT.Section, ByVal fileName As String, ByVal srLeft As Long, ByVal srTop As Long) As CRAXDRT.Report
Dim sr As CRAXDRT.SubreportObject
Set sr = destSection.ImportSubreport(CStr(fileName), CLng(srLeft), CLng(srTop))
sr.BottomLineStyle = crLSNoLine
sr.TopLineStyle = crLSNoLine
sr.LeftLineStyle = crLSNoLine
sr.RightLineStyle = crLSNoLine
Set loadSubreport = sr.OpenSubreport
End Function
一切正常。
但有时这条线:
Set sr = destSection.ImportSubreport(CStr(fileName), CLng(srLeft), CLng(srTop))
给error: Invaild procedure call or argument
.
如果尝试再次打印,它工作正常。
我尝试添加一些错误处理,再次运行相同的代码,但它仍然无法正常工作。
有人知道这个吗?