2 Replies Latest reply on Jul 27, 2017 3:48 AM by Gary Liptrot

    Multipages, forms and label refreshing

    Gary Liptrot

      Not quite sure about this one;  I have a macro with a userform featuring a 4 page multipage control and a different context menu on each page.  Page 4 (multipage(3) ) is always enabled regardless.  On form initialise the code determines if the active doc is a Part file or Assembly file and in the case of a Part, loads Multipage(0) and disables pages (1) and (2), whilst in the event of an Assembly file, Page (0) is disabled and (1) and (2) are enabled, with the form showing page (1).


      I have two (disabled) textboxes (one on Page(0) and one on Page(1)) where the mass (massprop.Mass) is shown, and an adjacent command button that opens a popup form showing a checkbox, text box and OK and Cancel command buttons.  Ticking the checkbox and typing a value in the textbox allows the user to override the mass of the part or assembly (myMassProp.SetOverrideMassValue()).  On completion, the main form textboxes update with the new, overridden mass.  I've got that bit all working nicely.

       

      As an extra refinement I've decided today to change the font colour of the label next to the Mass textboxes to red with a control tip text, to indicate if the mass value is overridden or not.  A simple "If statement" takes care of that and when the override checkbox is unticked, the label font goes back to black. When I test it running on a Part file, it works nicely.  The issue is, when its an Assembly file, the label changes to red OK, but wont go back to black when you revert back to a calculated mass instead of user-overridden.  If I flick to multipage(2) and back to multipage(1) its gone back to black, but it wont auto update on closing the popup like it does with Part files.  The colour changing If statement encompasses both labels' fore colour within so its not like I've made a mistake on the code somewhere, as it works for Part files!


      I'm relatively inexperienced with VBA so apologies for the messiness of the code - I'm sure it can be tidied up and compressed but on this particular issue, I'm stumped.

       

      Any help is much appreciated.