Launch a Report from JetReport from NAV

swjswj Member Posts: 68
Hello,

I want to add a button e.g in the Customer Card that will launch an excel report from Jet Report.
I adopted code that I find from internet. The report can be launched fine, but after finish there is an error prompted and I can run the form anymore.


I am using Jet Report 9.2 and NAV 2009. In my PC is installed Office 2007.
Here is the code I adopted:

IF CREATE(XL, TRUE) THEN BEGIN
XL.Interactive := TRUE;
XL.Visible := TRUE;
XL.Workbooks.Open('C:\Program Files (x86)\JetReports\JetReports.xlam');
Workbook := XL.Workbooks.Open('C:\Program Files (x86)\JetReports\Customer.xls');
XL.Run('JetMenu','Report');
XL.Run('Events');
worksheet.PrintPreview;
Workbook.Saved := TRUE;
XL.Quit;
END;

I tried to remark line " XL.Run('Events');" but still got the error.
Sign In or Register to comment.