Userform with commandbar popup

N

Neil

Hi there

It seems that many people have had issues with getiing popup
commandbars to work correctly with userforms.

I am at the stage where this all works fine, however, my problem is
that I show userform A, that shows userform B containing a treeview
from which the user can select options.

Userform B has the popup commandbar that allows the user, for example,
to select, rename or add options if they don't see what they want in
the list.

Userform B can also, in some cases, invoke another instance of itself
in the case where the option they want is already in a predfined list.

The problem I have is that, given that the commandbar popup onaction
module can only be a general module (?) I cannot tell which instance
of userform B I am talking to.

My addin will eventually become a COM addin, hopefully, so I do not
want to link anything to a workbook or sheet.

Any help or ideas would be gratefully received.
 
N

Neil

Hi there

It seems that many people have had issues with getiing popup
commandbars to work correctly with userforms.

I am at the stage where this all works fine, however, my problem is
that I show userform A, that shows userform B containing a treeview
from which the user can select options.

Userform B has the popup commandbar that allows the user, for example,
to select, rename or add options if they don't see what they want in
the list.

Userform B can also, in some cases, invoke another instance of itself
in the case where the option they want is already in a predfined list.

The problem I have is that, given that the commandbar popup onaction
module can only be a general module (?) I cannot tell which instance
of userform B I am talking to.

My addin will eventually become a COM addin, hopefully, so I do not
want to link anything to a workbook or sheet.

Any help or ideas would be gratefully received.

I think I've got it - I had to save a reference to the userform that
invoked the commandbar popup at the time I create the commandbar
itself - then in the commandbar onaction I pick up the saved userform
reference and use that as the object base.
 
N

Neil

I think I've got it - I had to save a reference to the userform that
invoked thecommandbarpopup at the time I create thecommandbar
itself - then in thecommandbaronactionI pick up the saved userform
reference and use that as theobjectbase.

OK, I'm still having problems and would appreciate some help.

I have created a class module that displays a treeview within a
userform. The treeview can display several data types. For example,
the user gets presented with a tree of service providers which are
indexed uniquely by name and country. If the user chooses to add a
new service provider, then he will be presented with a second userform
( a second instance of the same userform) that contains a treeview of
the countries they may choose from.

Each instance of the treeview userform creates a commandbar popup that
has awareness of the treeview content, for example, in the first
instance to select, add, rename or delete the service provider name,
and in the second instance to select, add, rename, delete a country.

From what I've understood from this forum and other sources, the
CommandBar Popup OnAction target can only reside in a general module.

So, my original problem still exists - how can I set things up so that
the general OnAction module knows which instance of the treeview
userform to act upon?

One idea, I guess, is to stack the objects that contain the userform
treeviews in a collection and key them on the userform caption - I
guess this is what windows does?

If I could pass the OnAction module a parameter of the parent treeview
userform then it would be much easier.

Anyone have any ideas?

Many thanks......Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top