Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Mar 2003
    Location
    Elkins Park, Pennsylvania, USA
    Posts
    325
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms in Code (Word XP)

    Hi, all.
    I have seen in some templates that some programmers/designers store complete forms (i.e. with the labels and drop-downs all filled out, etc.), while others store essentially blank forms and populate or customize them at run-time. Does one method have an advantage over another? What about the notion of creating them entirely via code at run-time? Does anybody know what is more efficient? Does one method make the template smaller or faster, compared to others?
    <font face="Comic Sans MS">That's what you do in a herd; you look out for each other!</font face=comic> - Mike

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Forms in Code (Word XP)

    VBA UserForms? It's hard enough if you create them in advance!! The only reason I would ever create one at run-time was if its contents depended on user identity or other changeable data.

  4. #3
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms in Code (Word XP)

    I never created VBA Forms in code, so I cannot comment on that.
    About pre-filling: that depends. If I'm very sure that the items in a dropdown never change (i.e. Yes/No/Maybe) I pre-fill the dropdown (with the default value on top of the list of course). But if it is to be expected that the list of items changes every now and then, I prefer to use a blank field and populate it at run time, i.e. from an INI file stored in a network path available for everyone as read-only. This has at least two benefits:
    - it allows for fast changes, editing just the INI file - no change (and sometimes redistribution) of template necessary;
    - it's possible to adapt those changes in existing documents too if desired, just by re-reading the INI file.

  5. #4
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms in Code (Word XP)

    And even then it's rarely necessary, I think. You can do a lot with hiding/showing and/or relocating elements in a VBA Form. And if the necessary changes are to complex for that, you can always revert to another "prefab" form in the same project. Because I think that in most cases you can reasonably predict what is needed and anticipate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •