Excel 2016 ActiveX Performance Issue

This forum allows developers to post programming tips and coding techniques that may be useful to other Visual LANSA developers. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
caseywhite
Posts: 60
Joined: Thu May 26, 2016 1:17 am

Excel 2016 ActiveX Performance Issue

Post by caseywhite » Wed Dec 06, 2017 6:25 am

Here is a tip for anyone using Excel 2016 and Visual LANSA. If the spreadsheet being written to will have a significant amount of data written to it and the view of the spreadsheet is set to page layout in the template, you should first set the view to Normal after opening the spreadsheet and then set it back to page layout just before saving it. Depending on the amount of data the difference could be minutes (or tens of minutes) vs. seconds. The code to set the view is:

Code: Select all

#L_Application.ActiveWindow.View := EXCEL2016.xlNormalView
where the ID of the Excel ActiveX is EXCEL2016 and the L_Application is defined as:

Code: Select all

Define_Com Class(#Excel_2016_ActiveX.Application) Name(#L_Application) Reference(*DYNAMIC)
To set is back to page layout view before saving use this code:

Code: Select all

#L_Application.ActiveWindow.View := EXCEL2016.xlPageLayoutView

Post Reply