Annoying Dialog Box Behavior, Populating with Previously Used Values

Discussion in 'SolidWorks' started by Tin Man, Jun 22, 2007.

  1. Tin Man

    Tin Man Guest

    Have you ever noticed that annoying Dialog Box behavior where it
    (sometimes) populates with previously used values (usually when you
    don't want it to), rather than the initial values you specified...I
    finally figured a way around it.

    Since SolidWorks actually keeps macros open in the background after
    you run them as discussed in:
    http://groups.google.com/group/comp.cad.solidworks/browse_thread/thread/6840a051c50aeac2?hl=en

    Even tho I Unload the Form at the end of each macro, I think somehow
    it is not getting completely unloaded. I noticed that values set in
    any Procedures not under a dialog box, seemed to always work. But
    values specified in the UserForm_Initialize event or even just the
    default values of the dialog box...where not being correctly
    initialized during subsequent runs of a macro during a SolidWorks
    secession. After some experimenting, and finally getting it to repeat
    I found that the UserForm_Initialize event procedure was not being
    called during the runs that were populating with the previously used
    values.

    The solution that seems to be working so far is to add a "Unload
    Userform1" line right before the "Load Userform1" call. If you have
    multiple "Load Userform1" line calls (if for whatever reason you are
    opening and closing a Userform multiple times during a single
    processing of the macro), then you only need to add the "Unload
    Userform1" line before the *first* "Load Userform1" call.

    Later,
    Ken
     
    Tin Man, Jun 22, 2007
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.