VB Code help with Custom Table Text Style

VB Code help with Custom Table Text Style

Anonymous
Not applicable
767 Views
3 Replies
Message 1 of 4

VB Code help with Custom Table Text Style

Anonymous
Not applicable

I am looking for assitance with the VB code to change the text style within a custom table when it is created from a VB standalone program.  I am using Inventor 2013 and VB 2010 Express.

 

I have a customtable that is created within a .idw, and I would like to have the data cells set to "Table_Cells" style that I have created.  I cannot find anything in the help file with a sample code to build off.

 

I figure it's got to be something with oCustomTable.DataTextStyle but beyond that I am lost.

 

This is what I have, and VB is kicking it back in my face.

 

Dim oTextStyle As TextStyle
oTextStyle = oCustomTable.DataTextStyle.StyleType("Table_Cells")

 Error    2    'Public ReadOnly Property StyleType As Inventor.StyleTypeEnum' has no parameters and its return type cannot be indexed.

 

0 Likes
Accepted solutions (1)
768 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

This is what I'm trying to set (forgot to attach the picture)

0 Likes
Message 3 of 4

barbara.han
Alumni
Alumni
Accepted solution

You can refer to this:

Sub test()

Dim doc As DrawingDocument

Set doc = ThisApplication.ActiveDocument

doc.ActiveSheet.CustomTables.Item(1).DataTextStyle = doc.StylesManager.TextStyles.Item("Table_Cell")

End Sub

 

DataTextStyle is writable property. You can't change DataTextStyle.StyleType because it's read-only.

Barbara Han
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 4 of 4

Anonymous
Not applicable

Thank you for the response, that worked perfect!

 

 

0 Likes