ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
JGJOHN GEORGE28/06/2015

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

    Next   

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