Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Find cell in custom table

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
phillip.shields
620 Views, 2 Replies

Find cell in custom table

Hello,

 

I'm trying to search a custom table and output the values using a for loop. I'm having trouble accessing the cells in the column I want though. The problem child seems to be Line 18. Any help would be appreciated.

 

' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument
Dim sheet1 as Sheet = oDrawDoc.Sheets("Sheet:1")
Dim table As CustomTable = sheet1.CustomTables.Item(1)
MessageBox.Show("0", "Title")

   
' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To table.Rows.Count
MessageBox.Show(i, "Title")

'look at only the DWG NO. column
oCell  = table.Rows.Item(i).Item("DWG NO.")
MessageBox.Show(oCell, "Title")
Next

 

2 REPLIES 2
Message 2 of 3
gadurai
in reply to: phillip.shields

Hi,

.

I think you are missing the declaration for Ocell. In your code declare the following 

 

Dim oCell As Cell

 

'look at only the DWG NO. column
oCell  = table.Rows.Item(i).Item("DWG NO.")

Messagebox.Show(oCell.Value,"Title").

 

The Following is my VBA code for your reference.

 

*****

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument
Dim sheet1 As Sheet
Set sheet1 = oDrawDoc.Sheets("Sheet:1")
Dim table As CustomTable
Set table = sheet1.CustomTables.Item(1)



' Iterate through the contents of the parts list.
Dim i As Long
For i = 1 To table.Rows.Count
Dim oCell As Cell
'look at only the DWG NO. column
Set oCell = table.Rows.Item(i)(2)

Debug.Print (oCell.Value)
Next

End Sub

********

 

Regards,

Appadurai.G

Message 3 of 3
phillip.shields
in reply to: gadurai

That's perfect thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report