PC Review


Reply
Thread Tools Rate Thread

How do I Get a String... or any variable for that matter?

 
 
QNiehausen
Guest
Posts: n/a
 
      16th Aug 2008
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 With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      16th Aug 2008
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.

 
Reply With Quote
 
QNiehausen
Guest
Posts: n/a
 
      16th Aug 2008
thank you, but a "call" is the first step ~after~ the value has been
grabbed/picked. I need something that displays a dialog box of some sort
asking the user which direction he wants the macro to continue. It's got to
be some sort of "get" procedure or method.

"JLGWhiz" wrote:

> 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 With Quote
 
QNiehausen
Guest
Posts: n/a
 
      16th Aug 2008
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.

 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      16th Aug 2008
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 With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      16th Aug 2008
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.

 
Reply With Quote
 
QNiehausen
Guest
Posts: n/a
 
      16th Aug 2008
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
>
>

 
Reply With Quote
 
QNiehausen
Guest
Posts: n/a
 
      16th Aug 2008
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.

 
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
Trying To Append String Variable To Another String Variable =?Utf-8?B?Sm9lIEsu?= Microsoft Excel Programming 3 6th Oct 2007 02:11 AM
non-variable matter in roman Mike Microsoft Word Document Management 3 10th May 2007 05:20 AM
Variable Declaration - Does Location Matter? =?Utf-8?B?WUdlZWs=?= Microsoft Dot NET 7 29th Apr 2005 03:56 PM
Connection String object Convert to String Variable Type =?Utf-8?B?TWlrZSBNb29yZQ==?= Microsoft ASP .NET 2 26th Oct 2004 03:43 PM
setting a range variable equal to the value of a string variable Pilgrim Microsoft Excel Programming 2 1st Jul 2004 11:32 PM


Features
 

Advertising
 

Newsgroups
 


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