From: intet.nyt on
Hi,

Maybe this is a simple thing, but I don't seem to be able to track it
down. I have an Excel sheet with a couple of Scenarios defined. I am
trying to implement some VBA functions where I need to know which
Scenario is currently selected. Does anyone know how I determine the
active Scenario from VBA?

Any help will be greatly appreciated. Thanks in advance.

Best regards.
From: H�ctor Miguel on
hi, (?)

> Maybe this is a simple thing, but I don't seem to be able to track it down.
> I have an Excel sheet with a couple of Scenarios defined.
> I am trying to implement some VBA functions where I need to know which Scenario is currently selected.
> Does anyone know how I determine the active Scenario from VBA?
> Any help will be greatly appreciated. Thanks in advance.

this code line returns a null string ("") if no scenario is active/selected/... or, the name of current scenario:

application.commandbars.findcontrol(id:=1737).text

hth,
hector.


From: Lasse on
Hi Hector,

Thank you so much for your answer - it was exactly what I was looking for.

BTW - sorry for not replying earlier; I have been away from home for a period, and first saw the answer today.

Thanks again!

Best regards

Lasse



H?ctor Miguel wrote:

hi, (?
01-Feb-10

hi, (?)


this code line returns a null string ("") if no scenario is active/selected/... or, the name of current scenario:

application.commandbars.findcontrol(id:=1737).text

hth,
hector.

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Dr. Dotnetsky's Cool .Net Tips and Tricks No. 26
http://www.eggheadcafe.com/tutorials/aspnet/8e390106-20d1-4b2b-be30-cde5d852348d/dr-dotnetskys-cool-net.aspx
From: intet.nyt on
On Feb 2, 5:51 am, "Héctor Miguel" <NOhemiordiS...(a)PLShotmail.com>
wrote:
> hi, (?)
>
> > Maybe this is a simple thing, but I don't seem to be able to track it down.
> > I have an Excel sheet with a couple of Scenarios defined.
> > I am trying to implement some VBA functions where I need to know which Scenario is currently selected.
> > Does anyone know how I determine the active Scenario from VBA?
> > Any help will be greatly appreciated. Thanks in advance.
>
> this code line returns a null string ("") if no scenario is active/selected/... or, the name of current scenario:
>
> application.commandbars.findcontrol(id:=1737).text
>
> hth,
> hector.

Hello again,

Now another problem has arisen. When I call the code you mention, I
get a new error:

-------------------
Run-time error '-2147467259 (80004005)':

Method 'Text' of object '_CommandBarComboBox' failed.
-------------------

What can be?

Thanks in advance.

Best regards,
Lasse
From: intet.nyt on
On Feb 22, 10:34 am, "intet....(a)gmail.com" <intet....(a)gmail.com>
wrote:
> On Feb 2, 5:51 am, "Héctor Miguel" <NOhemiordiS...(a)PLShotmail.com>
> wrote:
>
> > hi, (?)
>
> > > Maybe this is a simple thing, but I don't seem to be able to track it down.
> > > I have an Excel sheet with a couple of Scenarios defined.
> > > I am trying to implement some VBA functions where I need to know which Scenario is currently selected.
> > > Does anyone know how I determine the active Scenario from VBA?
> > > Any help will be greatly appreciated. Thanks in advance.
>
> > this code line returns a null string ("") if no scenario is active/selected/... or, the name of current scenario:
>
> > application.commandbars.findcontrol(id:=1737).text
>
> > hth,
> > hector.
>
> Hello again,
>
> Now another problem has arisen. When I call the code you mention, I
> get a new error:
>
> -------------------
> Run-time error '-2147467259 (80004005)':
>
> Method 'Text' of object '_CommandBarComboBox' failed.
> -------------------
>
> What can be?
>
> Thanks in advance.
>
> Best regards,
> Lasse

Hello again,

I actually found out myself; the reason was that the button I used to
trig the function had the property "TakeFocusOnClick" set to "True".
When I changed that to "False", the problem disappeared.

Best regards,
Lasse
 | 
Pages: 1
Prev: Locked cells
Next: stop numbers auto rounding