Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    NJ, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy Userform from master then display (Word 2000, VBA 6.3)

    Hello,

    I have a userform that I want to display when a user creates a new document from a template. Since the userform will be the same for multiple templates, I want to be able to maintain the userform in a "master" template on the network, and then when a user starts a new document based on the template, the userform will be copied into the document and then displayed automatically. I have used the master/copy functionality before, so I have that working, but when it hits the code to display the form that was just copied in, I get "Run time error 424. Object Required" as if it cannot find the form. Is what I want to do possible? Can anyone offer any assistance or ideas. Let me know if you need any more information from me.

    Thanks in advance,
    magella

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Copy Userform from master then display (Word 2000, VBA 6.3)

    Magella,

    There are two practical ways to store and display the userform: (1) store the userform in the 'attached template' from which the new document is created, (2) store the userform in a global template.

    I've never used the latter method (which sounds closer to what you want) so can't offer much advice on techniques, but the method you describe of copying a userform from a global template into a new document at runtime, sounds like a non-starter. When you create a userform in design mode in the VBE, behind the scenes the userform object is getting registered so that when code calls it during runtime, the userform object can be found.
    If you are instead creating a new userform at runtime, it seems likely that you'd run into problems like you describe.

    Most likely, rather than have the userform in the global template be called from the new document's attached template code, instead you would want to have the procedure to create a new document from any of the individual templates, be located in the global template. This procedure would take care of displaying the userform (which is stored in the global template), and then based on what the user selects in the userform, the code behind the userform would create a new document based on the appropriate template (hope that sentence makes sense!).

    Gary

  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    NJ, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy Userform from master then display (Word 2000, VBA 6.3)

    Hi Gary,

    Yes - your sentence did make sense! Thanks for the suggestion--I will have to try it out!

    Thanks,
    magella

Posting Permissions

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