Page 1 of 1

Excel 2016 ActiveX Performance Issue

Posted: Wed Dec 06, 2017 6:25 am
by caseywhite
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