Solved

Error: Unable to get a handle to the workbook

  • 8 September 2020
  • 2 replies
  • 231 views

Hi

I am getting the following error while executing my code in AIMMS.

spreadsheet::RetrieveTable(BCLOAD.xlsx, Load_Base(h,y,a), B3:CM8786, A3:A8786, B1:CM2, Load, 1) unable to get a handle to the workbook: Could not open Excel.

I believe it is happening after some automatic updates on my Microsoft office. Previously it was working fine.

I tried to reinstall my office, change my excel file name, or even copied the project folder to my PC from the google drive. None of them resolved the issue.

It would be grate if you can help me with this issue.

icon

Best answer by rezakhalili 9 September 2020, 18:42

View original

2 replies

It was working previously with this syntax.

However, I used the AXLL library and it solved the issue. 

 

 

Userlevel 6
Badge +6

It seems to me you might be missing parentheses around the file name, the ranges and the sheet name

spreadsheet::RetrieveTable("BCLOAD.xlsx", Load_Base, "B3:CM8786", "A3:A8786", "B1:CM2", "Load", 1) 

For reference: https://documentation.aimms.com/functionreference/data-management/spreadsheet-functions/spreadsheet_retrievetable.html

if that is not the case and it worked before; best to share the project here and send it to support@aimms.com

 

Good to be aware of: We recommend using the newer AXLL library (which is newer and can read XLS/XLXS files without the need of having Excel installed). This library also has functions to determine the number of rows with data so you do not have to hard code a large range.
See https://how-to.aimms.com/Articles/85/85-using-axll-library.html

Reply


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator