I have a problem with a VB script below, which is opening .rpt report ( data from MS Access DB ) and exporting it to XLS (Excel) file. It works perfectly when it runs in MFC EXE app without any prompts. If we run it in Web App where it is executed by vb engine it come to the “Report.Export False” and hangs the application. It prints “Start” and never come to “Finish”. No errors, no exceptions, no logs in System Even Viewer even if I intentionally change the output file path to some non exiting one. It means it is happened before attempting to open .xls file.
Do you have an idea why it is happening?
Thank you in advance for your help,

Private Sub Command1_Click()
On Error GoTo Login_Error

Dim objApplicat As Object
Set objApplication = CreateObject("CrystalRuntime.Application")

Dim strPath As String
strPath = "c:\\InvoiceReport.rpt"

Dim objReport As Object
Set objReport = objApplication.OpenReport(strPath, 1)

objReport.EnableParameterPrompting = False
objReport.ExportOptions.UseReportDateFormat = 1
objReport.ExportOptions.UseReportNumberFormat = 1
objReport.DisplayProgressDialog = False
objReport.ExportOptions.FormatType = 21 'crEFTExcel50
objReport.ExportOptions.DiskFileName = "c:\temp\Crystal.xls"
objReport.ExportOptions.DestinationType = 1 'crEDTDiskFile
objReport.ExportOptions.ExcelAreaType = 4 'crDetail
objReport.ExportOptions.ExcelConvertDateToString = False
objReport.ExportOptions.ExcelUseWorksheetFunctions = False

If False = ReportConnectExternalDatabase(objReport, "InvoiceDemo1", "", "") Then
Debug.Print "err"
End If

Debug.Print "Start"
objReport.Export False
Debug.Print "Finish"

Exit Sub


Debug.Print "Description: " & Err.Description & " " & "Number: " & Err.Number & " " & "LastDllError: " & Err.LastDllError & " " & "Source: " & Err.Source

End Sub

Function ReportConnectExternalDatabase(ByRef objReport As Object, _
ByVal strDSN As String, _
ByVal strU As String, _
ByVal strP As String) As Boolean
ReportConnectExternalDatabase = True
strU = strU
strP = strP
If (strDSN = "") Then
strDSN = "InvoiceDemo1"
If (strU = "") Then
strU = "User"
End If
If (strP = "") Then
strP = "password"
End If
End If

Dim i As Integer

Dim nTablesCount As Integer
nTablesCount = objReport.Database.Tables.Count
Debug.Print "objReport.Database.Tables.Count " & Str(objReport.Database.Tables.Count)
For i = 1 To nTablesCount
objReport.Database.Tables(i).SetLogOnInfo strDSN, strDSN, strU, strP
Debug.Print "strDSN " & strDSN
Debug.Print "strU " & strU
Debug.Print "strP " & strP

'Test connection
ReportConnectExternalDatabase = objReport.Database.Tables(i).TestConnectivity
If ReportConnectExternalDatabase = False Then
Exit For
End If
Next i

End Function