• VB and existing Forms (VB6/VBA)

    Author
    Topic
    #359465

    Edited by dansy on 25-Aug-01 07:43.

    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. confused

    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.

    Viewing 0 reply threads
    Author
    Replies
    • #539020

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

      • #539029

        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.

        • #539129

          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.

          • #539132

            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?

    Viewing 0 reply threads
    Reply To: VB and existing Forms (VB6/VBA)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: