Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do I find the currently selected Scenario?

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default How do I find the currently selected Scenario?

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.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I find the currently selected Scenario?

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...-cool-net.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do I find the currently selected Scenario?

On Feb 2, 5:51*am, "Héctor Miguel"
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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do I find the currently selected Scenario?

On Feb 22, 10:34*am, "
wrote:
On Feb 2, 5:51*am, "Héctor Miguel"
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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find out how many rows I have selected? ABR Excel Discussion (Misc queries) 7 April 3rd 23 10:56 AM
VBA: How do I find a value within a selected range? Jayne22 Excel Programming 2 August 13th 08 09:04 PM
Find Selected value to .Offset from Corey Excel Programming 0 January 11th 07 10:34 PM
how to find if diagram is selected? Chimanrao Excel Programming 2 November 12th 05 11:11 AM
Find out what is selected for AutoFilter Dan Excel Programming 1 July 20th 05 05:21 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"