PC Review


Reply
Thread Tools Rate Thread

ActiveX control dilemma

 
 
Brett
Guest
Posts: n/a
 
      17th May 2009
I have a "master" ActiveX Combobox on a sheet which I copy & paste anything
up to 30 times for each client. I would like to shift the focus from the
control after it has had a data change (say select the linked cell for that
control). The problem as I see it is that even though I can have a change
macro for the master it would need to be duplicated for each control and
that's not really feasible (using Chip Pearson's code to copy a macro into a
module).

Is there a more generic way that I can set it up to select the control's
linked cell (or any other cell) please?. Brett
 
Reply With Quote
 
 
 
 
joel
Guest
Posts: n/a
 
      17th May 2009
You can have a common routine for all the controls. You need to have a
minimum of 3 lines in each On change macro

Private Sub ListBox1_Click()
call CommonClick
end Sub

You may need to pass a parameter to the common routine depending on what you
are doings

Private Sub ListBox1_Click()
call CommonClick("listbox1")
end Sub

"Brett" wrote:

> I have a "master" ActiveX Combobox on a sheet which I copy & paste anything
> up to 30 times for each client. I would like to shift the focus from the
> control after it has had a data change (say select the linked cell for that
> control). The problem as I see it is that even though I can have a change
> macro for the master it would need to be duplicated for each control and
> that's not really feasible (using Chip Pearson's code to copy a macro into a
> module).
>
> Is there a more generic way that I can set it up to select the control's
> linked cell (or any other cell) please?. Brett

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      17th May 2009
Hi Joel, actually each macro would only be that long
PS
Range select
ES
but the problem is creating that macro for each control anyway (there's 90
potential comboboxes, of which up to 30 can be used at any given time, so
they're created on demand).


"joel" wrote:

> You can have a common routine for all the controls. You need to have a
> minimum of 3 lines in each On change macro
>
> Private Sub ListBox1_Click()
> call CommonClick
> end Sub
>
> You may need to pass a parameter to the common routine depending on what you
> are doings
>
> Private Sub ListBox1_Click()
> call CommonClick("listbox1")
> end Sub
>
> "Brett" wrote:
>
> > I have a "master" ActiveX Combobox on a sheet which I copy & paste anything
> > up to 30 times for each client. I would like to shift the focus from the
> > control after it has had a data change (say select the linked cell for that
> > control). The problem as I see it is that even though I can have a change
> > macro for the master it would need to be duplicated for each control and
> > that's not really feasible (using Chip Pearson's code to copy a macro into a
> > module).
> >
> > Is there a more generic way that I can set it up to select the control's
> > linked cell (or any other cell) please?. Brett

 
Reply With Quote
 
joel
Guest
Posts: n/a
 
      17th May 2009
You are going to have to have the 30 or 90 mactos. When you create the
control on demand you have to give the control one of the 90 names of the
prediefined macrtos. You dont have to create the macro after the control
exists.

VBA will give the control a name which you can change after to create it on
demand to the control name match the name in the predefined macro.

"Brett" wrote:

> Hi Joel, actually each macro would only be that long
> PS
> Range select
> ES
> but the problem is creating that macro for each control anyway (there's 90
> potential comboboxes, of which up to 30 can be used at any given time, so
> they're created on demand).
>
>
> "joel" wrote:
>
> > You can have a common routine for all the controls. You need to have a
> > minimum of 3 lines in each On change macro
> >
> > Private Sub ListBox1_Click()
> > call CommonClick
> > end Sub
> >
> > You may need to pass a parameter to the common routine depending on what you
> > are doings
> >
> > Private Sub ListBox1_Click()
> > call CommonClick("listbox1")
> > end Sub
> >
> > "Brett" wrote:
> >
> > > I have a "master" ActiveX Combobox on a sheet which I copy & paste anything
> > > up to 30 times for each client. I would like to shift the focus from the
> > > control after it has had a data change (say select the linked cell for that
> > > control). The problem as I see it is that even though I can have a change
> > > macro for the master it would need to be duplicated for each control and
> > > that's not really feasible (using Chip Pearson's code to copy a macro into a
> > > module).
> > >
> > > Is there a more generic way that I can set it up to select the control's
> > > linked cell (or any other cell) please?. Brett

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      17th May 2009
Hi Joel - yes, I thought it may end up as that, but I was trying to avoid
carrying all those macros around in each book (one of them has 3 x 90
potentials!). Thanks, Brett

"joel" wrote:

> You are going to have to have the 30 or 90 mactos. When you create the
> control on demand you have to give the control one of the 90 names of the
> prediefined macrtos. You dont have to create the macro after the control
> exists.
>
> VBA will give the control a name which you can change after to create it on
> demand to the control name match the name in the predefined macro.
>
> "Brett" wrote:
>
> > Hi Joel, actually each macro would only be that long
> > PS
> > Range select
> > ES
> > but the problem is creating that macro for each control anyway (there's 90
> > potential comboboxes, of which up to 30 can be used at any given time, so
> > they're created on demand).
> >
> >
> > "joel" wrote:
> >
> > > You can have a common routine for all the controls. You need to have a
> > > minimum of 3 lines in each On change macro
> > >
> > > Private Sub ListBox1_Click()
> > > call CommonClick
> > > end Sub
> > >
> > > You may need to pass a parameter to the common routine depending on what you
> > > are doings
> > >
> > > Private Sub ListBox1_Click()
> > > call CommonClick("listbox1")
> > > end Sub
> > >
> > > "Brett" wrote:
> > >
> > > > I have a "master" ActiveX Combobox on a sheet which I copy & paste anything
> > > > up to 30 times for each client. I would like to shift the focus from the
> > > > control after it has had a data change (say select the linked cell for that
> > > > control). The problem as I see it is that even though I can have a change
> > > > macro for the master it would need to be duplicated for each control and
> > > > that's not really feasible (using Chip Pearson's code to copy a macro into a
> > > > module).
> > > >
> > > > Is there a more generic way that I can set it up to select the control's
> > > > linked cell (or any other cell) please?. Brett

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User Account Control dilemma Ron Windows Vista General Discussion 1 5th Nov 2008 12:10 AM
validator control dilemma part 2 =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 0 24th Aug 2006 02:15 PM
validator control dilemma part 1 =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 0 24th Aug 2006 02:09 PM
ActiveX Control prompt "An ActiveX control on this page might be u =?Utf-8?B?UmFodWw=?= Windows Vista General Discussion 2 1st Aug 2006 05:08 PM
Set focus on a form control dilemma Chris Microsoft ASP .NET 0 10th Nov 2003 10:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:10 PM.