AnsweredAssumed Answered

SolidWorks UserForm Macro - Controls from Textbox

Question asked by JOHN GEORGE on Jun 28, 2015
Latest reply on Jul 17, 2015 by JOHN GEORGE

I have a macro with a user form to add custom properties to file. (part and assembly)

It's working as required, but it is adding all property names to the file even if the values are empty.

Below is the code that controls the function


Function UpdateCustomPropsFromControls()


    Dim objControl As Control

    Dim objTextBox As Object

    Dim objControls As Controls   


    Set objControls = UserForm1.Controls


    For Each objControl In objControls

        If objControl.Tag <> "" Then

            Set objTextBox = objControl


            ModelDoc.DeleteCustomInfo2 cmbConfigToUpdate.text, objTextBox.Tag           

            ModelDoc.AddCustomInfo3 cmbConfigToUpdate.text, objTextBox.Tag, swCustomInfoText, objTextBox.text


        End If


End Function

Can someone please modify this code, so that if a text box is empty or without any value, that property name shouldn't be added to the file properties


Thanks in advance