Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I Get a String... or any variable for that matter?

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How do I Get a String... or any variable for that matter?

After looking at your posting again, I am not sure that I really understood
what you were asking. Could you give an example of how you would use such a
command?


"QNiehausen" wrote:

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I Get a String... or any variable for that matter?

Sure. I currently have a macro that runs 70 scenarios, 35 for each of two
clients. Sometimes the results require a little tweaking for either client's
data, and then I run the macro again. However, it takes about five seconds
per scenario, which leaves a waiting time of almost 5 minutes per cycle.
If I only need to run the new numbers of one of the clients, it can cut the
time in half. So, I'm trying to find a way to stop the macro with a dialog
box that asks if I want to run Client1, Client2 or Both. From that answer, I
can easily write in an If-Then or a Call to branch off in the proper
direction. Problem is, I'm going nuts trying to find the way to do it.

"JLGWhiz" wrote:

After looking at your posting again, I am not sure that I really understood
what you were asking. Could you give an example of how you would use such a
command?


"QNiehausen" wrote:

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How do I Get a String... or any variable for that matter?

If you only have two choices you could use a message box with a Yes/No option.

Choice = MsgBox("Click Yes for Client 1, No for Client 2, Cancel for both", _
vbYes?No, "Choose Scenario")
If Choice = vbYes Then
Call Scenario1
ElseIf Choice = vbNo Then
Call Scenario2
Else
Call Scenario3
End If

Otherwise, if there are more scenarios then maybe a UserForm with a ListBox
would work. The UserForm will pause the macro, just like the message box,
until a selection is made from the list box and the subsequent code executes
to return to the main macro.






"QNiehausen" wrote:

Sure. I currently have a macro that runs 70 scenarios, 35 for each of two
clients. Sometimes the results require a little tweaking for either client's
data, and then I run the macro again. However, it takes about five seconds
per scenario, which leaves a waiting time of almost 5 minutes per cycle.
If I only need to run the new numbers of one of the clients, it can cut the
time in half. So, I'm trying to find a way to stop the macro with a dialog
box that asks if I want to run Client1, Client2 or Both. From that answer, I
can easily write in an If-Then or a Call to branch off in the proper
direction. Problem is, I'm going nuts trying to find the way to do it.

"JLGWhiz" wrote:

After looking at your posting again, I am not sure that I really understood
what you were asking. Could you give an example of how you would use such a
command?


"QNiehausen" wrote:

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I Get a String... or any variable for that matter?

Thanks for the quickness of this reply... this looks like either solution
will work. Have a great night!

Bill

"JLGWhiz" wrote:

If you only have two choices you could use a message box with a Yes/No option.

Choice = MsgBox("Click Yes for Client 1, No for Client 2, Cancel for both", _
vbYes?No, "Choose Scenario")
If Choice = vbYes Then
Call Scenario1
ElseIf Choice = vbNo Then
Call Scenario2
Else
Call Scenario3
End If

Otherwise, if there are more scenarios then maybe a UserForm with a ListBox
would work. The UserForm will pause the macro, just like the message box,
until a selection is made from the list box and the subsequent code executes
to return to the main macro.






"QNiehausen" wrote:

Sure. I currently have a macro that runs 70 scenarios, 35 for each of two
clients. Sometimes the results require a little tweaking for either client's
data, and then I run the macro again. However, it takes about five seconds
per scenario, which leaves a waiting time of almost 5 minutes per cycle.
If I only need to run the new numbers of one of the clients, it can cut the
time in half. So, I'm trying to find a way to stop the macro with a dialog
box that asks if I want to run Client1, Client2 or Both. From that answer, I
can easily write in an If-Then or a Call to branch off in the proper
direction. Problem is, I'm going nuts trying to find the way to do it.

"JLGWhiz" wrote:

After looking at your posting again, I am not sure that I really understood
what you were asking. Could you give an example of how you would use such a
command?


"QNiehausen" wrote:

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default How do I Get a String... or any variable for that matter?

QNiehausen wrote:
With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.


Hi Q,

Sounds like a job for a combobox. Create a standard module, in this add
a form with a combobox and a command button. Add something like this to
the module code:

Private Sub UserForm_Initialize()
ComboBox1.AddItem "Run Evens Only"
ComboBox1.AddItem "Run Odds Only"
End Sub

Private Sub CommandButton1_Click()
Select Case ComboBox1.Value
Case "Run Evens Only"
MsgBox "Run Evens"
Case "Run Odds Only"
MsgBox "Run Odds"
Case Else
MsgBox "Nothing selected"
End Select
End Sub

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I Get a String... or any variable for that matter?

Thank you... this looks like it'll do it! And thanks for the quickness of
the reply, as well!

Bill

"smartin" wrote:

QNiehausen wrote:
With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.


Hi Q,

Sounds like a job for a combobox. Create a standard module, in this add
a form with a combobox and a command button. Add something like this to
the module code:

Private Sub UserForm_Initialize()
ComboBox1.AddItem "Run Evens Only"
ComboBox1.AddItem "Run Odds Only"
End Sub

Private Sub CommandButton1_Click()
Select Case ComboBox1.Value
Case "Run Evens Only"
MsgBox "Run Evens"
Case "Run Odds Only"
MsgBox "Run Odds"
Case Else
MsgBox "Nothing selected"
End Select
End Sub


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default How do I Get a String... or any variable for that matter?

How about "Call"?

"QNiehausen" wrote:

With VB, I've used the GetOpenFilename and GetSaveAsFilename methods to
acquire text strings to be used for other parts of my scripts, but I can't
find a simple "Get" method that simply allows the user to select from a list
of strings to determine the course of the macro to continue. Y'know, like
"Select an Option"--"Run Evens Only","Run Odds Only","Run Both". That's it.
I've wasted hours searching through an 867-page manual and can't find
anything. "InputBox" method comes close, but it asks for the string to be
typed in. I need the input option to be a pre-defined list, or even buttons.
Is there a key word I'm missing? I've looked under "get", "acquire",
"select", "choose", "pick". Please help.

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
Trying To Append String Variable To Another String Variable Joe K. Excel Programming 3 October 6th 07 02:11 AM
Variable in string DevinC Excel Discussion (Misc queries) 5 January 26th 06 08:59 PM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
How do I convert an integer variable to a string variable? dumbass Excel Programming 2 May 21st 04 07:34 PM
Join string with variable name to get variable value Dianne Excel Programming 6 February 12th 04 04:24 AM


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

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

About Us

"It's about Microsoft Excel"