- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How can I select and delete two custom tables from a drawing using iLogic?
A drawing may or may not contain these two custom tables, but when it does, they will always have the same Title ( oTable.Title property ) - let's say "Table1" and "Table2" - in a For loop such as
For Each oTable As CustomTable In ThisApplication.ActiveDocument.ActiveSheet.CustomTables
For the purpose of coding it should be simpler to delete these tables and recreate them using the same code that originally created them from model properties and parameters; instead of modifying cell values. The new tables may have a different number of rows. When the model is updated, running this iLogic rule will update some tabulated manufacturing data by deleting the old tables in the drawing and making new tables.
The problem I have is that my For loop above which steps through all the custom tables in a drawing will find and delete the tables, but then the iLogic ends - it doesn't exit the loop nicely and carry on through the code. I suspect it runs into trouble after the tables are deleted, and there are no more custom tables to loop through.
Is there an alternative way to select these tables by Title and delete them? Perhaps without using a For loop?
I have tried counting the custom tables and looping based on the count, but this doesn't seem to work either. The internet seems to think a loop is the best way to select the tables, but I'm not convinced.
Solved! Go to Solution.