0 Replies Latest reply on Jan 17, 2018 1:09 PM by Tomas Yaczik

    Using VBA to drive design table dimension values and feature states

    Tomas Yaczik

      I'm fairly new to using design tables and have very limited knowledge of visual basic, but have experience with java so I'm not a completely lost cause here.

      My issue is this.

       

      I'm using a design table to define the suppression states of features in my model and the values of various dimensions within. Many of the dimension values and determined suppression states, are driven by simple IF Else IF functions in a module in visual basic. Once I thought I was done with the coding and getting all the values to equal what I wanted them to for the model, I linked the excel file to my part that drives the model. (These values and dimension assignments were all previously checked for correct functionality in Solidworks equations full of IF and Else IF statements prior to the creation of the VBA functions in the design table, so all the output values match between the equations and the design table and produced no errors or warnings). Once the design table was successfully linked and I didn't have any errors when opening or closing the design table from the part in Solidworks, I deleted all the equations and made sure the dimensions had changed color to ensure they had indeed linked to their respective names in the design table. However, once the design table was linked, for whatever reason, when I tried to put dimension variables in the design table afterwards because I had forgotten them, a link could not be created. I could manually edit the value of the dimension, newly linked to the design table, regardless of its definition within (design table said it was 5.5mm, but I would change it to whatever I wanted anyway). I tried restarting Solidworks, relinking the table with the previously forgotten dimensions variable BEFORE hand this time, and tried doing the same thing with other dimensions hoping that it was just a glitch with the dimension I was trying to drive with the design table. Why is this happening? Is there any way around it, or could it have anything to do with the fact that I had to change the format of the excel file to a macro-enabled workbook (.xlsm), thus causing possible compatibility issues with Solidworks?