Consulting

Results 1 to 11 of 11

Thread: Add-in with Forms

  1. #1
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Out of interest, how do you make use of an Add-In created in Visual Basic 6 which contains forms.

    I've got an .xla that I use for something but I fancy trying to recreate it in VB6. It has two forms. The minute I chose the Add-in option for a new project I was given a form that I couldn't preview and any tutorials I've looked for online have all been for a .dll file which just adds extra functions to Excel.

  2. #2
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    I want to store some stuff with my add-in for retrieval next time a user opens Excel. Is this possible to write their preferences to the remaining sheet in my .xla and retrieve them whenever necessary.

  3. #3
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    I would suggest the registry. I think the sheets don't exist in the Com Add-in.

  4. #4
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Quote Originally Posted by Tommy
    I would suggest the registry. I think the sheets don't exist in the Com Add-in.
    As I said in the second post, I'm talking about an .xla this time.

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,906
    Location
    Sure it is. Just refer, in your add-in code, to ThisWorkbook.Sheets... That should work for you. You can reference to and from your add-in sheets, but it must all be done via code, so it's probably best to test in an xls first, imo.

  6. #6
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    Sorry, I got confused I thought I was in another question thread. In that case the sheet(s) do still exist, as firefytr has already said

  7. #7
    VBAX Mentor XL-Dennis's Avatar
    Joined
    May 2004
    Location
    ?stersund, Sweden
    Posts
    499
    Location
    Use the registry to read & write the settings

    Check SaveSettings, GetSettings and DeleteSettings in the directhelp.

    I use it regular and it's a fast & reliable way for storing values of any kind.

    Other than that I must admit I'm a little bit lost in this thread

    Kind regards,
    Dennis
    Kind regards,
    Dennis

    ExcelKB | .NET & Excel | 2nd edition PED


  8. #8
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    Thanks. Works Zach, the sheets thing works great.

    I'll look up the Settings methods too - doesn't hurt to know.

    Still, though, anybody know about the forms in a VB addin?

  9. #9
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    I can look into it what do you need to know? I am working on one now that is being translated from VBA for Excel.

  10. #10
    VBAX Tutor SJ McAbney's Avatar
    Joined
    May 2004
    Location
    Glasgow
    Posts
    243
    Location
    In VB6 there is a number of wizards that help create the default application of your choice: .exe .dll ActiveX, etc. and one of these options is Add-In.

    When I select it I get the typical environment with a default form. When I try to run the add-in (by preview) nothing happens - the form doesn't even show.

    It's just a question to see if anyone knows what the deal is with making form based addins for Excel from VB6...

  11. #11
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    When you run the addin you need to set the option for startup, or on demand. Then start up Excel. You will be able to step through you code at this point. I have found that I can't seem to get to the Menus, but can create toolbars and buttons all day long.
    http://support.microsoft.com/default...EN-US%3B238228
    This link is what I used to get started. You can translate almost all (I say that cause I haven't found one I couldn't but you never know) of VBA straight from Excel. Just export the files. In VB when you are referencing a excel function, it is easier to fully qualify the vars so VB doesn't get confused and use it's definition instead of Excel's.

    btw You will not see the default form, I have no clue why cause you can run the code in the form but unless you say .show you will not see it.

Posting Permissions

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