Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2001
    Location
    Perth,(aka middle of nowhere), Western Australia, Australia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VB and existing Forms (VB6/VBA)

    <P ID="edit" class=small>Edited by dansy on 25-Aug-01 07:43.</P>How do I import an existing UserForm created under VBA into a fully fledged VB6 program.

    I need to make modifications to the form so therefore need access to the toolbox in VB.
    However, I have tried >Project>Add Form>Existing in the Visual Studio VB6 IDE and while it adds the form, it adds it as a "designer" (which is something I have not used before but has peaked my interest to explore further) add greys out the toolbox?

    I want to be able to reuse forms as templates wherever possible. This is the first time I have tried to take a Userform created in VBA (Word 97) and bring it into a real VB environment. This was never a problem going from VB version to version.
    Its probably obvious but I can't seem to see it. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

    NOTE : I should note that I am aware (and have tried) that new form templates can be created by adding the form to the template folder but this still not solving the problem where the control toolbox is greyed out. I want to add DriveList, DirList and FIleList boxes to the form (the common control in this case does not exactly fit the bill for what I need) but can't get access to them - greyed out.

  2. #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: VB and existing Forms (VB6/VBA)

    You can export the form from VBA to a file (2 files, actually). Maybe that will import into VB?

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and existing Forms (VB6/VBA)

    You can export from VBA, and that can be imported by VB- but not in the same format as a normal VB.

    If you export a form, then add an existing "exported" form to a VB project, you will get a "Designer" added to your project rather than a form. I don't know what the differences are, but I do know that if you view the source of a VB form (which is mostly text with a minimum amount of non-text info in a "frx" form) it's totally different from the source of an exported VBA form (with some text and loads of stuff in the frx form).

    That probably doesn't make much difference- it seems to work. But a form created by VB cannot be opened by VBA.

    And there will be a lot of Word- specific stuff you will have to work out.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    Lounger
    Join Date
    Aug 2001
    Location
    Perth,(aka middle of nowhere), Western Australia, Australia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and existing Forms (VB6/VBA)

    Thats correct - I have tried all this and found the documentation on "Designers" lacking.
    I have also tried cutting and pasting the controls of the resulting imported designer form to a new form in VB but this doesn't work either. Any pointers to a healthy description of VB Form designers and how to exploit them would be most welcome.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VB and existing Forms (VB6/VBA)

    One possibility would be to create your own export function- for each control, create a text description of the control and its properties in the same format as VB expects.

    It would take a bit of work though. It would depend on how many of these you expect to do. It might be shorter to recreate a form manually in VB.

    It seems strange that a "designer" form (seems to) allow complete control over existing controls; you can copy a control to create a new one (even from another exported Userform); but you can't create a new one from scratch.

    Perhaps you could create one form with one of each control for later copying when needed?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

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