PDA

View Full Version : Advice: Add-in with Forms



SJ McAbney
08-17-2004, 03:43 AM
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.

SJ McAbney
08-18-2004, 07:26 AM
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.

Tommy
08-18-2004, 08:29 AM
I would suggest the registry. I think the sheets don't exist in the Com Add-in.

SJ McAbney
08-18-2004, 08:39 AM
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. :)

Zack Barresse
08-18-2004, 08:41 AM
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.

Tommy
08-18-2004, 10:30 AM
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 :)

XL-Dennis
08-18-2004, 10:54 AM
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

SJ McAbney
08-19-2004, 06:00 AM
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? :confused:

Tommy
08-19-2004, 06:20 AM
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.

SJ McAbney
08-19-2004, 06:46 AM
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...

Tommy
08-19-2004, 07:12 AM
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.aspx?scid=kb%3BEN-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.