iLogic rule

iLogic rule

Anonymous
Not applicable
501 Views
4 Replies
Message 1 of 5

iLogic rule

Anonymous
Not applicable

hey everyone.

 

today i wanted to make a code to read some values from an excel, but when i'm running it i get the error that:

"Error in rule: Parameter, in document: Layout.iam

Excel cell not found (bad cell address?): "A"

"

I have used the following funtion

 

Dim A = GoExcel.CellValue("A" & i)

 

 

The excel is saved in the same folder as the assembly and in the beginning i have used a function to open the excel data.

 

Thanks

0 Likes
Accepted solutions (1)
502 Views
4 Replies
Replies (4)
Message 2 of 5

mcgyvr
Consultant
Consultant

Can you post the excel file and complete code? More of the code at the very least..

Have you tried replacing the variable with a fixed cell value to ensure that works first? (walk before you run kind of stuff)

Where have you defined which excel file it should be reading from,etc...?



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 3 of 5

Anonymous
Not applicable
GoExcel.Open(Link, "Tabelle1")


Planexo = GoExcel.CellValue("F3")
Planex1 = GoExcel.CellValue("F4")
Planex2 = GoExcel.CellValue("F5")
Planex3= GoExcel.CellValue("F6")
Planex4= GoExcel.CellValue("F7")
Planex5= GoExcel.CellValue("F8")
Planex6= GoExcel.CellValue("F9") 
Planey0= GoExcel.CellValue("H3")
Planey1 = GoExcel.CellValue("H4")
Planey2 = GoExcel.CellValue("H5")
Planey3 = GoExcel.CellValue("H6")
Planey4 = GoExcel.CellValue("H7")
Planey5 = GoExcel.CellValue("H8")
Planey6 = GoExcel.CellValue("H9")


'[length of arrays

For Each xVar In PlaneX
	
	lenX = lenX + 1

Next

For Each yVar In PlaneY

	lenY = lenY + 1
	
Next
']


'[sorting the array with distance

For j = 0 To lenX - 2
	
	For h = 0 To lenX - 2
	
		If PlaneX(h)>PlaneX(h+1)
			temp = PlaneX(h)>PlaneX(h+1)
			PlaneX(h + 1) = PlaneX(h)
			PlaneX(h) = temp
		End If
	Next
Next 


For j = 0 To lenY - 2
	
	For h = 0 To lenY - 2
		
		If PlaneY(h) >PlaneY(h + 1)
			temp = PlaneY(h) >PlaneY(h + 1)
			PlaneX(h + 1) = PlaneY(h)
			PlaneY(h) = temp
		End If 
	Next
Next
']

While Bool 
	
	A = GoExcel.CellValue("A" & i)
	
	If String.Compare(Left(A, 2), "No") = 0 
	
		If String.Compare(Left(Right(A, 2), 1), "x") = 0 
			Plane.Add(i) 
			PlaneName.Add("Ebene" & Right(A, 2)) 
			NumberOfPlane.Add(GoExcel.CellValue("B" & i)) 
			xy.Add("x")
		
		Else If String.Compare(Left(Right(A, 3), 1), "x") = 0 
			Plane.Add(i) 
			PlaneName.Add("Ebene" & Right(A, 2)) 
			NumberOfPlane.Add(GoExcel.CellValue("B" & i)) 
			xy.Add("x")
		
		Else If String.Compare(Left(Right(A, 2), 1), "y") = 0 
			Plane.Add(i) 
			PlaneName.Add("Ebene" & Right(A, 2)) 
			NumberOfPlane.Add(GoExcel.CellValue("B" & i)) 
			xy.Add("y")
		
		Else If String.Compare(Left(Right(A, 3), 1), "y") = 0 
			Plane.Add(i) 
			PlaneName.Add("Ebene" & Right(A, 2)) 
			NumberOfPlane.Add(GoExcel.CellValue("B" & i)) 
			xy.Add("y")
		
		Else If String.Compare(Right(A, 8), "Förderer") = 0
			Bool = False
		
		End If
	
	End If
	
	If i = 1000
		Bool = False
		
	End If
	i=i+1

End While


this is the code that i wrote. the excel table is defined in parameters a text file under the name "Link".
the program opens the data, but it can't read the columm A for some reason.
This is the first time that this happens to me.
0 Likes
Message 4 of 5

SharkDesign
Mentor
Mentor

Did you try restarting your computer?

I've had loads of issues with Excel and iLogic before. I've spent hours trying to fix it, then I reboot my computer and magically it just works again. 

  Inventor Certified Professional
0 Likes
Message 5 of 5

A.Acheson
Mentor
Mentor
Accepted solution

I always start with a simple cell reference to ensure you can write or read from it. This ensures correct linkage with excel. 

Dim A = GoExcel.CellValue("A" & 1)

‘or
Dim i as integer

i=1

Dim A = GoExcel.CellValue("A" & i)



If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes