- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
ilogic and excel issue
when running some ilogic script that references an external excel sheet to read/write data, I keep getting "Belt Data.xlsx is already open" error.
I have done everything from add goexcel.save / close at the end of the rules, running silent operations, etc.
I am at my wits end. Is this an inventor issue? (If so, how do I fix it)
Is this an excel issue?
Arghh please help.
I am attaching the part file and excel file to help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Try below changes in iLogic code.
ThisApplication.SilentOperation = True
'GoExcel.Open("M:\0700 Engineering\0770 DOCUMENTS\Excel Files\Belt Data.xlsx", "Belt_Data")
'Set Belt Series Multi-value list
MultiValue.List("BSeries") = GoExcel.CellValues("C:\Users\t_gc\Downloads\Belt Data.xlsx", "Belt_Data", "B4", "b147")
'Series = Parameter("BSeries")
rangeArray = GoExcel.NamedRangeValue("BS_" & BSeries)
'define and set Series Style list based on Belt Series
Dim oList As New ArrayList
'Check if rangeArray is an array or a Single Row
If IsArray(rangeArray)
'Count the number of rows in array
Dim oRowCount As Integer
oRowCount = rangeArray.GetLength(0)
'Populate arraylist
Dim oRowIndex As Integer
For oRowIndex = 1 To oRowCount
oList.Add(rangeArray(oRowIndex, 1))
Next
'Populate MultiValue Parameter
MultiValue.List("BStyle") = oList
Else
Series_val = Parameter("BSeries")
' Style_Val = Parameter("BStyle")
GoExcel.TitleRow = 3
i = GoExcel.FindRow("C:\Users\t_gc\Downloads\Belt Data.xlsx", "Belt_Data", "SERIES", "=", Series_val)
b = GoExcel.CurrentRowValue("SERIES")
MessageBox.Show(b)
'Parameter("BStyle")=goExcel.CurrentRowValue("STYLE")
End If
'GoExcel.Open("M:\0700 Engineering\0770 DOCUMENTS\Excel Files\Belt Data.xlsx", "Sprocket_Data")
'Set Spr_PD Multi-value list
PD= Parameter("Spr_PD")
SP_rangeArray = GoExcel.NamedRangeValue("SP_" & Parameter("BSeries"))
'define and set Sprocket PD list based on Belt Series
Dim sList As New ArrayList
'Count the number of rows in array
Dim sRowCount As Integer
sRowCount = SP_rangeArray.GetLength(0)
'Populate arraylist
Dim sRowIndex As Integer
For sRowIndex = 1 To sRowCount
sList.Add(SP_rangeArray(sRowIndex, 1))
Next
'Populate MultiValue Parameter
MultiValue.List("Spr_PD") = sList
Call GoExcel.Close ()
iLogicVb.UpdateWhenDone = True
Thanks and regards,
CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thank you Chandra. Works alot better, but it still says that the "Belt Data.xlsx is already ope. Reopening will cause any changes you made to be discarded. Do you want to reopen Belt Data.xlsx.
Could this be an excel issue, since I am using the "Indirect" Function in the spreadsheet?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Many times the problem is that when you write and test you programm, you come past the open excel part, but not past the close part, so the excel files is opened in the background.
so the second time you run the program, you get the problem that the file is already open
look in the windows task manager, than close all excel processes, then try again.
(if you change the excel with your code, you have to save and than close it)
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think something similar is happening to me. I have some rules to modify one excel sheet, the code is different to the one show above but i believe that the error appears due to the excel is also open in the background. I have tried to close it in the windows task manager but it is still opened. Any other idea to try? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
when you try to close the excel proces in the task mnger, do you get an error?
when you retart you PC, and after it i rebooted look in the task manager, before you open any other program, is the excel proces started?
maybe something else than your program is using excel?
Kudo's are also appreciated
Succes on your project, and have a nice day
Herm Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It seems to be closed alright, none error appears.
I think I have solved the problem by restarting the PC after closing the excel in the task manager, at least for now.
Thanks for the quickly answer ![]()