GoExcel issues after Excel upgrade ("MyFile.xlsx is already open.")

GoExcel issues after Excel upgrade ("MyFile.xlsx is already open.")

Anonymous
Not applicable
520 Views
3 Replies
Message 1 of 4

GoExcel issues after Excel upgrade ("MyFile.xlsx is already open.")

Anonymous
Not applicable

"OriginalGetComponentPath" is my old code, which worked fine until my Excel was upgraded (from 2010 to 2016).

I created "TestGetComponentPath" recently for troubleshooting.

Both functions bring up a prompt saying "MyFile.xlsx is already open. Reopening will cause any changes you made to be discarded. Do you want to reopen MyFile.xlsx?" at the GoExcel.Cellvalue row.

 

Is there an issue with the code, or is it the new Excel installation?

Help is greatly appreciated! 

 

Class Runme
	Sub Main
		Dim ComponentName As String = ""
		ComponentName = OriginalGetComponentPath("MyComponent")
		ComponentName = TestGetComponentPath("MyComponent")
	End Sub


	Public Function OriginalGetComponentPath(Denomination As String) As String
		Dim RefRow = GoExcel.FindRow("3rd Party:ConfiguratorParameters", "FileReferences", "Description", "=", Denomination)
		Dim ComponentPath = GoExcel.CellValue("3rd Party:ConfiguratorParameters", "FileReferences", "D" & RefRow)
		Return ComponentPath
	End Function
	
	Public Function TestGetComponentPath(Denomination As String) As String
		GoExcel.Close
		MessageBox.Show("1", "Title")
		Dim RefRow = GoExcel.FindRow("3rd Party:ConfiguratorParameters", "FileReferences", "Description", "=", Denomination)
		
		MessageBox.Show("2", "Title")
		GoExcel.Close
		Dim ComponentPath = GoExcel.CellValue("3rd Party:ConfiguratorParameters", "FileReferences", "D" & RefRow)
		
		MessageBox.Show("3", "Title")
		GoExcel.Close
		
		MessageBox.Show("4", "Title")
		Return ComponentPath
	End Function
End Class

 

123

0 Likes
521 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

I asked a colleague who's still using Excel 2010 to run following code:

 

 

		Dim RefRow = GoExcel.FindRow("3rd Party:ConfiguratorParameters", "FileReferences", "Description", "=", "MyComponent")
		Dim ComponentPath = GoExcel.CellValue("3rd Party:ConfiguratorParameters", "FileReferences", "D" & RefRow)

 

 

It works fine for him, but I get the error message.

 

So it seems to be an issue with the Excel 2016 installation/integration. Does anyone have any idea what to do?

 

Edit:

Apparently, even following code throws the same error. It seems impossible.

GoExcel.Close
GoExcel.Open("3rd Party:ConfiguratorParameters", "FileReferences")
Dim g = GoExcel.CellValue("D1")
GoExcel.Close

 

0 Likes
Message 3 of 4

Anonymous
Not applicable

Ok, so following code (using CurrentRowValue instead of CellValue) works:

GoExcel.FindRow("3rd Party:ConfiguratorParameters", "FileReferences", "Description", "=", "MyComponent")
Dim g = GoExcel.CurrentRowValue("ColumnName")
Logger.Info("Result: " & g)
GoExcel.Close

I'd still like to know why the previous code doesn't, if anyone knows.

0 Likes
Message 4 of 4

AMN3161
Advocate
Advocate

I have had a similar issue,

 

run your code and see if you have some background excels open in your task manager

 

if so toss this at the end of your rule

 

GoExcel.Close  

It wont close your open excels you are working with, just closes the background processes that inventor created during the code running 

 

edit, sorry didnt see that you already tried that. I had a bunch of background excel running after my code ran and it was causing problems. but it fixed it for me

0 Likes