Hi @J_Pfeifer_. My example code above may not be a good one to go by if you only need to create a new CustomTable, and do not need to update or change an already existing one. After changing the two lines of code you are showing, then you would have to also had to change this following line somehow.
Dim oContents() As String = GetSheetsData(oDDoc)
But in that example, it is calling a whole other code routine to set the value of that variable, so it would be pretty complicated to change just that one line to meet your needs. That custom Function it is calling to run, was specifically designed to collect data in a way that would work for a table with only two columns of data (Sheet Name & Sheet Revision). That resulting data would be patterned in a way that would result in the Sheet Name always ending up in the first column, while the Sheet Revision would always end up in the second column.
So, I will attempt to explain what is needed in your situation. That 'contents' array must end up with the same number of entries in it, as there will be cells in the table (one entry per cell). And, when creating a new table, and supplying that Array to it for the contents of the table, it will fill in the cells in the following way. It will start by filling in the top left cell, then fill in any cells to the right of that cell in that same row, then to the farthest left cell of the next row down, then across that row, and so on until it reaches the last cell on the right of that bottom row. Knowing that ahead of time helps, but it can still be difficult to plan putting the data entries into that Array in just the right way they they fill in the cells exactly the way you want them to be. What you can do though, is just supply an empty String for each cell (in the Array). Then, once the table has been created, it is easier to fill in the cell values the way you want the later by navigating the rows & columns of the table.
If a table already exists, and you just want to add more rows to it, or add more columns to it, then that is also easier to do than re-creating it from scratch. For this, we can use the CustomTable.Rows.Add() method, or the CustomTable.Columns.Add() method. In those methods, all 'inputs' they request are optional. Meaning, you can just create an empty new row or column, then fill in its contents later, if needed. When adding a new column, it does require that you at least specify a title for it though.
About Arrays (and similar):
One thing to keep in mind, that may help down the road...any type of collection type object that is defined by the VB.NET system will be 'zero based' (first item is at Index of zero, not one). But any collection type of object that is defined by Autodesk Inventor API or iLogic will be 'one based' (first item is at Index of one, not zero).
With that in mind...
An Array is a 'fixed size' type of collection. So, when we create one, we have to do one of two things...specify how big it should be, or specify all of its contents at one time, which will set its size to the number of things you initially put into it. In my example above, I did the second way. I set all its contents at one time, because I was not sure how many entries it would need. If I know how many entries it will need to contain (4 columns x 4 rows = 16 cells) then I can do it that way, and that would look like:
Dim oContents(15) As String
...even though we need it to hold 16 entries, because the first entry will be at Index zero, then the 16th entry will be at Index 15. When we specify its size, then we can leisurely set the entry values later, using multiple lines of code, instead of all at once, on one line of code.
oContents(0) = "Upper-Left Cell (A1)"
oContents(1) = "Next Cell To The Right (B1)"
oContents(2) = "Next Cell To The Right (C1)"
oContents(3) = "Last Cell In First Row (D1)"
oContents(4) = "First Cell In Second Row (A2)"
oContents(4) = "Second Cell In Second Row (B2)"
'...and so on
oContents(15) = "Last Cell In Last Row (D4)"
Wesley Crihfield

(Not an Autodesk Employee)